--------------------------
To install ``librados`` development support files for C/C++ on Debian/Ubuntu
-distributions, execute the following::
+distributions, execute the following:
- sudo apt-get install librados-dev
+.. prompt:: bash $
+
+ sudo apt-get install librados-dev
To install ``librados`` development support files for C/C++ on RHEL/CentOS
-distributions, execute the following::
+distributions, execute the following:
+
+.. prompt:: bash $
- sudo yum install librados2-devel
+ sudo yum install librados2-devel
Once you install ``librados`` for developers, you can find the required
-headers for C/C++ under ``/usr/include/rados``. ::
+headers for C/C++ under ``/usr/include/rados``:
+
+.. prompt:: bash $
- ls /usr/include/rados
+ ls /usr/include/rados
Getting librados for Python
directly too.
To install ``librados`` development support files for Python on Debian/Ubuntu
-distributions, execute the following::
+distributions, execute the following:
- sudo apt-get install python-rados
+.. prompt:: bash $
+
+ sudo apt-get install python3-rados
To install ``librados`` development support files for Python on RHEL/CentOS
-distributions, execute the following::
+distributions, execute the following:
+
+.. prompt:: bash $
+
+ sudo yum install python-rados
- sudo yum install python-rados
+To install ``librados`` development support files for Python on SLE/openSUSE
+distributions, execute the following:
+
+.. prompt:: bash $
+
+ sudo zypper install python3-rados
You can find the module under ``/usr/share/pyshared`` on Debian systems,
or under ``/usr/lib/python*/site-packages`` on CentOS/RHEL systems.
To install ``librados`` for Java, you need to execute the following procedure:
-#. Install ``jna.jar``. For Debian/Ubuntu, execute::
+#. Install ``jna.jar``. For Debian/Ubuntu, execute:
+
+ .. prompt:: bash $
- sudo apt-get install libjna-java
+ sudo apt-get install libjna-java
- For CentOS/RHEL, execute::
+ For CentOS/RHEL, execute:
- sudo yum install jna
+ .. prompt:: bash $
+
+ sudo yum install jna
The JAR files are located in ``/usr/share/java``.
-#. Clone the ``rados-java`` repository::
+#. Clone the ``rados-java`` repository:
+
+ .. prompt:: bash $
- git clone --recursive https://github.com/ceph/rados-java.git
+ git clone --recursive https://github.com/ceph/rados-java.git
-#. Build the ``rados-java`` repository::
+#. Build the ``rados-java`` repository:
- cd rados-java
- ant
+ .. prompt:: bash $
+
+ cd rados-java
+ ant
The JAR file is located under ``rados-java/target``.
#. Copy the JAR for RADOS to a common location (e.g., ``/usr/share/java``) and
- ensure that it and the JNA JAR are in your JVM's classpath. For example::
+ ensure that it and the JNA JAR are in your JVM's classpath. For example:
+
+ .. prompt:: bash $
+
+ sudo cp target/rados-0.1.3.jar /usr/share/java/rados-0.1.3.jar
+ sudo ln -s /usr/share/java/jna-3.2.7.jar /usr/lib/jvm/default-java/jre/lib/ext/jna-3.2.7.jar
+ sudo ln -s /usr/share/java/rados-0.1.3.jar /usr/lib/jvm/default-java/jre/lib/ext/rados-0.1.3.jar
- sudo cp target/rados-0.1.3.jar /usr/share/java/rados-0.1.3.jar
- sudo ln -s /usr/share/java/jna-3.2.7.jar /usr/lib/jvm/default-java/jre/lib/ext/jna-3.2.7.jar
- sudo ln -s /usr/share/java/rados-0.1.3.jar /usr/lib/jvm/default-java/jre/lib/ext/rados-0.1.3.jar
+To build the documentation, execute the following:
-To build the documentation, execute the following::
+.. prompt:: bash $
- ant docs
+ ant docs
Getting librados for PHP
To install the ``librados`` extension for PHP, you need to execute the following procedure:
-#. Install php-dev. For Debian/Ubuntu, execute::
+#. Install php-dev. For Debian/Ubuntu, execute:
+
+ .. prompt:: bash $
+
+ sudo apt-get install php5-dev build-essential
+
+ For CentOS/RHEL, execute:
- sudo apt-get install php5-dev build-essential
+ .. prompt:: bash $
- For CentOS/RHEL, execute::
+ sudo yum install php-devel
- sudo yum install php-devel
+#. Clone the ``phprados`` repository:
-#. Clone the ``phprados`` repository::
+ .. prompt:: bash $
- git clone https://github.com/ceph/phprados.git
+ git clone https://github.com/ceph/phprados.git
-#. Build ``phprados``::
+#. Build ``phprados``:
- cd phprados
- phpize
- ./configure
- make
- sudo make install
+ .. prompt:: bash $
-#. Enable ``phprados`` in php.ini by adding::
+ cd phprados
+ phpize
+ ./configure
+ make
+ sudo make install
- extension=rados.so
+#. Enable ``phprados`` by adding the following line to ``php.ini``::
+
+ extension=rados.so
Step 2: Configuring a Cluster Handle
}
-Compile your client and link to ``librados`` using ``-lrados``. For example::
+Compile your client and link to ``librados`` using ``-lrados``. For example:
- gcc ceph-client.c -lrados -o ceph-client
+.. prompt:: bash $
+
+ gcc ceph-client.c -lrados -o ceph-client
C++ Example
Compile the source; then, link ``librados`` using ``-lrados``.
-For example::
+For example:
+
+.. prompt:: bash $
- g++ -g -c ceph-client.cc -o ceph-client.o
- g++ -g ceph-client.o -lrados -o ceph-client
+ g++ -g -c ceph-client.cc -o ceph-client.o
+ g++ -g ceph-client.o -lrados -o ceph-client
print("Connected to the cluster.")
-Execute the example to verify that it connects to your cluster. ::
+Execute the example to verify that it connects to your cluster:
+
+.. prompt:: bash $
- python ceph-client.py
+ python ceph-client.py
Java Example
Compile the source; then, run it. If you have copied the JAR to
``/usr/share/java`` and sym linked from your ``ext`` directory, you won't need
-to specify the classpath. For example::
+to specify the classpath. For example:
- javac CephClient.java
- java CephClient
+.. prompt:: bash $
+
+ javac CephClient.java
+ java CephClient
PHP Example
}
-Save this as rados.php and run the code::
+Save this as rados.php and run the code:
+
+.. prompt:: bash $
- php rados.php
+ php rados.php
Step 3: Creating an I/O Context