参考这篇博客
https://blog.csdn.net/for_tech/article/details/80271495
step 1
执行以下两条指令
在你的管理节点的工作目录下,给 Ceph 对象网关节点安装Ceph对象所需的软件包
ceph-deploy install --rgw c4 c5 c6
新建网关实例
ceph-deploy --overwrite rgw create c4 c5 c6
执行上面的命令不成功
分别在每个gw节点上执行:yum install ceph-radosgw,然后再执行:ceph-deploy --overwrite rgw create controller-03 controller-04 controller-05成功。
可以看到网关已经运行。
ps aux | grep rados
2、在浏览器输入host:7480,可以看到正确运行
3、配置各节点网关
在c4执行:ceph auth get client.rgw.c4 > /etc/ceph/ceph.client.radosgw.keyring
在c5执行:ceph auth get client.rgw.c5 > /etc/ceph/ceph.client.radosgw.keyring
在c6执行:ceph auth get client.rgw.c6 > /etc/ceph/ceph.client.radosgw.keyring
5、创建cephgw存储池
6.创建radosgw用户进行访问
radosgw-admin user create --uid="admin" --display-name="admin"
[root@c4 ceph]# radosgw-admin user create --uid="admin" --display-name="admin"
{
"user_id": "admin",
"display_name": "admin",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"auid": 0,
"subusers": [],
"keys": [
{
"user": "admin",
"access_key": "NB8SR8JU85V16ROBD4B3",
"secret_key": "gkIxvICALUahng0MTlSXhNafdN2FVpwM0qDBTtRB"
}
],
"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",
"mfa_ids": []
}
======
radosgw-admin user create --secret="123456" --uid="zhangsan" --display-name="zhangsan"
客户端对接
S3cmd客户端
步骤1:安装s3cmd
[root@node1 ~]# yum -y install s3cmd
步骤2:配置s3cmd
[root@node1 ~]# s3cmd —configure
[root@c4 ceph]# s3cmd --configure
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.
Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
Access Key: NB8SR8JU85V16ROBD4B3
Secret Key: gkIxvICALUahng0MTlSXhNafdN2FVpwM0qDBTtRB
Default Region [US]:
Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
S3 Endpoint [s3.amazonaws.com]: c4:7480
Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used
if the target S3 system supports dns based buckets.
DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: buket
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password:
Path to GPG program [/usr/bin/gpg]:
When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP, and can only be proxied with Python 2.7 or newer
Use HTTPS protocol [Yes]: No
On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't connect to S3 directly
HTTP Proxy server name:
New settings:
Access Key: NB8SR8JU85V16ROBD4B3
Secret Key: gkIxvICALUahng0MTlSXhNafdN2FVpwM0qDBTtRB
Default Region: US
S3 Endpoint: c4:7480
DNS-style bucket+hostname:port template for accessing a bucket: buket
Encryption password:
Path to GPG program: /usr/bin/gpg
Use HTTPS protocol: False
HTTP Proxy server name:
HTTP Proxy server port: 0
Test access with supplied credentials? [Y/n] n
Save settings? [y/N] y
Configuration saved to '/root/.s3cfg'
[root@c4 ceph]#
步骤3:增删改查:
[root@c4 ceph]# s3cmd mb s3://first_bucket
Bucket 's3://first_bucket/' created
[root@c4 ceph]# s3cmd -v ls
2019-04-25 08:40 s3://first_bucket
[root@c4 ceph]# echo "aaaa" > file.txt
[root@c4 ceph]# ls
Make bucket
s3cmd mb s3://BUCKET
Remove bucket
s3cmd rb s3://BUCKET
List objects or buckets
s3cmd ls [s3://BUCKET[/PREFIX]]
List all object in all buckets
s3cmd la
Put file into bucket
s3cmd put FILE [FILE...] s3://BUCKET[/PREFIX]
Get file from bucket
s3cmd get s3://BUCKET/OBJECT LOCAL_FILE