S3 API-compatible Ceph object storage

Amazon offers Simple Storage Service (S3) to provide storage through web interfaces such as REST. Ceph extends its compatibility with S3 through RESTful API. S3 client applications can access the Ceph object storage based on access and secret keys. Let's now see how to configure this. Perform the following commands on the ceph-rgw node until otherwise specified:

  1. Radosgw users should have enough capabilities to allow S3 requests. Add the required capabilities to the radosgw user ID (mona):
    # radosgw-admin caps add --uid=mona  --caps="users=*"
    # radosgw-admin caps add --uid=mona  --caps="buckets=*"
    # radosgw-admin caps add --uid=mona  --caps="metadata=*"
    radosgw-admin caps add --uid=mona --caps="zone=*"
    
    S3 API-compatible Ceph object storage
  2. S3 also requires a DNS service in place as it uses the virtual host bucket naming convention <object_name>.<RGW_Fqdn>. For example, if you have a bucket named jupiter, it will be accessible over HTTP via the URL http://jupiter.ceph-rgw.objectstore.com.

    Perform the following steps to configure DNS on the ceph-rgw node. If you have an existing DNS server, you can use it with slight modifications.

    1. Install bind packages on the ceph-rgw node:
      # yum install bind* -y
      
    2. Edit /etc/named.conf, the IP address, and the IP range and zone as mentioned in the following code. You can match the changes from the author's version of the named.conf file provided with this book's code bundle:
      listen-on port 53 { 127.0.0.1;192.168.57.110; };  ### Add DNS IP ###
      
      allow-query     { localhost;192.168.57.0/24; };    ### Add IP Range ###
      
      ### Add new zone for domain objectstore.com before EOF  ###
      zone "objectstore.com" IN {
      type master;
      file "db.objectstore.com";
      allow-update { none; };
      };
    3. Save and exit your editor from /etc/named.conf.
    4. Create the zone file /var/named/db.objectstore.com with the following content. You can match the changes from the author's version of the db.objectstore.com file provided with this book:
      @ 86400 IN SOA objectstore.com. root.objectstore.com. (
              20091028 ; serial yyyy-mm-dd
              10800 ; refresh every 15 min
              3600 ; retry every hour
              3600000 ; expire after 1 month +
              86400 ); min ttl of 1 day
      @ 86400 IN NS objectstore.com.
      @ 86400 IN A 192.168.57.110
      * 86400 IN CNAME @
    5. Disable the firewall, or you can allow DNS rules from the firewall:
      # service iptables stop
      
    6. Edit /etc/resolve.conf and add the following content:
      search objectstore.com
      nameserver 192.168.57.110
    7. Start the named service:
      # service named start
      
    8. Test DNS configuration files for any syntax errors:
      # named-checkconf /etc/named.conf
      # named-checkzone objectstore.com /var/named/db.objectstore.com
      
    9. Test the DNS server:
      # dig ceph-rgw.objectstore.com
      # nslookup ceph-rgw.objectstore.com
      
    10. Apply the same DNS settings to ceph-client1, which will be our S3 client machine. Edit /etc/resolve.conf on ceph-client1 and add the following content:
      search objectstore.com
      nameserver 192.168.57.110
    11. Test the DNS settings on ceph-client1:
      # dig ceph-rgw.objectstore.com
      # nslookup ceph-rgw.objectstore.com
      
    12. The ceph-client1 machine should be able to resolve all the subdomains for ceph-rgw.objectstore.com.
    S3 API-compatible Ceph object storage
  3. Configure the S3 client (s3cmd) on ceph-client1:
    1. Install s3cmd:
      # yum install s3cmd
      
    2. Configuring s3cmd will require an access _key and secret_key for a user; in our case, the user ID is mona that we created in the first step:
      # s3cmd --configure
      
      S3 API-compatible Ceph object storage
    3. The s3cmd configure command will create the .s3cfg file under /root; edit this file for the RADOS gateway host details. Modify host_base and host_bucket, as shown in the following snippet. Make sure these lines do not have trailing spaces at the end:
      host_base = ceph-rgw.objectstore.com
      host_bucket = %(bucket)s.ceph-rgw.objectstore.com

    You can match the changes from the author's version of the .s3cfg file provided with this book.

    S3 API-compatible Ceph object storage
  4. Finally, we will create S3 buckets and put objects into it:
    # s3cmd ls
    # s3cmd mb s3://first-bucket
    # s3cmd put /etc/hosts s3://first-bucket
    
    S3 API-compatible Ceph object storage

Swift API-compatible Ceph object storage

Ceph supports a RESTful API that is compatible with the basic data access model of the Swift API. To use Ceph object storage using the Swift API, we need to create a Swift subuser on the Ceph RADOS gateway, which will allow the Swift API to access Ceph object storage:

  1. Log in to ceph-rgw and create a subuser for Swift access. The subuser will have its own secret key:
    # radosgw-admin subuser create --uid=mona --subuser=mona:swift --access=full --secret=secretkey --key-type=swift
    
    Swift API-compatible Ceph object storage
  2. Install a swift client on the ceph-client1 node:
    # yum install python-setuptools
    # easy_install pip
    # pip install --upgrade setuptools
    # pip install python-swiftclient
    
  3. Finally, create and list buckets using the swift client:
    #  swift -V 1.0 -A http://ceph-rgw.objectstore.com/auth -U mona:swift -K secretkey post example-bucket
    #  swift -V 1.0 -A http://ceph-rgw.objectstore.com/auth -U mona:swift -K secretkey list
    
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.205.235