]> git.proxmox.com Git - ceph.git/blobdiff - ceph/doc/rados/api/librados-intro.rst
import ceph quincy 17.2.6
[ceph.git] / ceph / doc / rados / api / librados-intro.rst
index 01ed49b92dd123e99caf35bd99757aadf1a77e6c..ed60f97b137965b47491b981085b20612554afe4 100644 (file)
@@ -43,19 +43,25 @@ Getting librados for C/C++
 --------------------------
 
 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
@@ -68,14 +74,25 @@ and the ``librados2-devel`` package for RHEL/CentOS will install the
 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.
@@ -86,37 +103,49 @@ Getting librados for Java
 
 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
@@ -124,29 +153,37 @@ 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
@@ -321,9 +358,11 @@ it and connecting to the cluster might look something like this:
 
        }
 
-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
@@ -399,10 +438,12 @@ you to initialize a ``librados::Rados`` cluster handle object:
        
 
 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
 
 
 
@@ -436,9 +477,11 @@ into exceptions.
                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
@@ -478,10 +521,12 @@ binding converts C++-based errors into exceptions.
 
 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
@@ -502,9 +547,11 @@ With the RADOS extension enabled in PHP you can start creating a new cluster han
        }
 
 
-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