美文网首页ceph
Ceph Object Gateway

Ceph Object Gateway

作者: Patrick_QiWei | 来源:发表于2017-11-30 16:10 被阅读14次

Environment


    1. CentOS Linux release  7.4.1708 (Core)(Basic-web安装)
    2. Ceph Luminous 12.2.1
    3. ceph-deploy 1.5.39
主机 别名
192.168.1.50 node1
192.168.1.51 node2

关于ceph的安装可参考ceph luminous安装

1.Installing ceph object gateway


ceph-deploy install --rgw node1 node2

2 Createing the ceph object gateway instance


ceph-deploy rgw create node1 node2

Once the gateway is running, you should be able to access it on port 7480. (e.g., http://client-node:7480).

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>anonymous</ID>
<DisplayName/>
</Owner>
<Buckets/>
</ListAllMyBucketsResult>

3.Configuring Ceph Object Gateway Instance


3.1 Modify your configuration file

 [client.rgw.node1]
 rgw_frontends = "civetweb port=80"

3.2 To make the new port setting take effect,restart the ceph object gateway

systemctl restart ceph-radosgw.target

4.CREATE A RADOSGW USER FOR S3 ACCESS


To create the user, execute the following on the gateway host:

# Enter the following on the node1
sudo radosgw-admin user create --uid="testuser" --display-name="First User"

The output of the command will be something like the following:

{
    "user_id": "testuser",
    "display_name": "First User",
    "email": "",
    "suspended": 0,
    "max_buckets": 1000,
    "auid": 0,
    "subusers": [],
    "keys": [
        {
            "user": "testuser",
            "access_key": "7JUPI1B4BMRDBWRFODID",
            "secret_key": "ZQsu6pfZ3lTh6oJiBLJetA1xM82sgwVLbDUiZ4I0"
        }
    ],
    "swift_keys": [],
    "caps": [],
    "op_mask": "read, write, delete",
    "default_placement": "",
    "placement_tags": [],
    "bucket_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    },
    "user_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    },
    "temp_url_keys": [],
    "type": "rgw"
}

Note The values of keys->access_key and keys->secret_key are needed for access validation.

5. TEST S3 ACCESS


You will need to install the python-boto package:

sudo yum install python-boto

Create the Python script:

vi s3test.py

Add the following contents to the file:

import boto.s3.connection

access_key = 'I0PJDPCIYZ665MW88W9R'
secret_key = 'dxaXZ8U90SXydYzyS5ivamEP20hkLSUViiaR+ZDA'
conn = boto.connect_s3(
        aws_access_key_id=access_key,
        aws_secret_access_key=secret_key,
        host='{hostname}', port={port},
        is_secure=False, calling_format=boto.s3.connection.OrdinaryCallingFormat(),
       )

bucket = conn.create_bucket('node1-bucket')
for bucket in conn.get_all_buckets():
    print "{name} {created}".format(
        name=bucket.name,
        created=bucket.creation_date,
    )

Replace {hostname} with the hostname of the host where you have configured the gateway service i.e., the gateway host. Replace {port} with the port number you are using with Civetweb.

Run the script:

python s3test.py

The output will be something like the following:

node1-bucket 2015-02-16T17:09:10.000Z

相关文章

网友评论

    本文标题:Ceph Object Gateway

    本文链接:https://www.haomeiwen.com/subject/ndambxtx.html