이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 3. Using The Gateway
To use the REST interfaces, first create an initial Ceph Object Gateway user for the S3 interface. Then, create a subuser for the Swift interface. You then need to verify if the created users are able to access the gateway.
3.1. Create a radosgw user for S3 access 링크 복사링크가 클립보드에 복사되었습니다!
A radosgw
user needs to be created and granted access. The command man radosgw-admin
will provide information on additional command options.
To create the user, execute the following on the gateway host
:
sudo radosgw-admin user create --uid="testuser" --display-name="First User"
sudo radosgw-admin user create --uid="testuser" --display-name="First User"
The output of the command will be something like the following:
The values of keys->access_key
and keys->secret_key
are needed for access validation.
3.2. Create a Swift user 링크 복사링크가 클립보드에 복사되었습니다!
A Swift subuser needs to be created if this kind of access is needed. Creating a Swift user is a two step process. The first step is to create the user. The second is to create the secret key. Execute the following steps on the gateway host
.
Create the Swift user:
sudo radosgw-admin subuser create --uid=testuser --subuser=testuser:swift --access=full
sudo radosgw-admin subuser create --uid=testuser --subuser=testuser:swift --access=full
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output will be something like the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the secret key:
sudo radosgw-admin key create --subuser=testuser:swift --key-type=swift --gen-secret
sudo radosgw-admin key create --subuser=testuser:swift --key-type=swift --gen-secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output will be something like the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3. Access Verification 링크 복사링크가 클립보드에 복사되었습니다!
3.3.1. Test S3 access 링크 복사링크가 클립보드에 복사되었습니다!
You need to write and run a Python test script for verifying S3 access. The S3 access test script will connect to the radosgw
, create a new bucket and list all buckets. The values for aws_access_key_id
and aws_secret_access_key
are taken from the values of access_key
and secret_key
returned by the radosgw_admin
command.
Execute the following steps:
You will need to install the
python-boto
package.sudo yum install python-boto
sudo yum install python-boto
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the Python script:
vi s3test.py
vi s3test.py
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following contents to the file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
{hostname}
with the hostname of the host where you have configured the gateway service i.e, thegateway host
.Run the script:
python s3test.py
python s3test.py
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output will be something like the following:
my-new-bucket 2015-02-16T17:09:10.000Z
my-new-bucket 2015-02-16T17:09:10.000Z
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3.2. Test swift access 링크 복사링크가 클립보드에 복사되었습니다!
Swift access can be verified via the swift
command line client. The command man swift
will provide more information on available command line options.
To install swift
client, execute the following:
sudo yum install python-setuptools sudo easy_install pip sudo pip install --upgrade setuptools sudo pip install --upgrade python-swiftclient
sudo yum install python-setuptools
sudo easy_install pip
sudo pip install --upgrade setuptools
sudo pip install --upgrade python-swiftclient
To test swift access, execute the following:
swift -A http://{IP ADDRESS}/auth/1.0 -U testuser:swift -K '{swift_secret_key}' list
swift -A http://{IP ADDRESS}/auth/1.0 -U testuser:swift -K '{swift_secret_key}' list
Replace {IP ADDRESS}
with the public IP address of the gateway server and {swift_secret_key}
with its value from the output of radosgw-admin key create
command executed for the swift
user.
For example:
swift -A http://10.19.143.116/auth/1.0 -U testuser:swift -K '244+fz2gSqoHwR3lYtSbIyomyPHf3i7rgSJrF/IA' list
swift -A http://10.19.143.116/auth/1.0 -U testuser:swift -K '244+fz2gSqoHwR3lYtSbIyomyPHf3i7rgSJrF/IA' list
The output should be:
my-new-bucket
my-new-bucket