参考这篇博客
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 --configureEnter 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: NB8SR8JU85V16ROBD4B3Secret Key: gkIxvICALUahng0MTlSXhNafdN2FVpwM0qDBTtRBDefault Region [US]:Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.S3 Endpoint [s3.amazonaws.com]: c4:7480Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be usedif the target S3 system supports dns based buckets.DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: buketEncryption password is used to protect your files from readingby unauthorized persons while in transfer to S3Encryption password:Path to GPG program [/usr/bin/gpg]:When using secure HTTPS protocol all communication with Amazon S3servers is protected from 3rd party eavesdropping. This method isslower than plain HTTP, and can only be proxied with Python 2.7 or newerUse HTTPS protocol [Yes]: NoOn some networks all internet access must go through a HTTP proxy.Try setting it here if you can't connect to S3 directlyHTTP Proxy server name:New settings:Access Key: NB8SR8JU85V16ROBD4B3Secret Key: gkIxvICALUahng0MTlSXhNafdN2FVpwM0qDBTtRBDefault Region: USS3 Endpoint: c4:7480DNS-style bucket+hostname:port template for accessing a bucket: buketEncryption password:Path to GPG program: /usr/bin/gpgUse HTTPS protocol: FalseHTTP Proxy server name:HTTP Proxy server port: 0Test access with supplied credentials? [Y/n] nSave settings? [y/N] yConfiguration saved to '/root/.s3cfg'[root@c4 ceph]#
步骤3:增删改查:
[root@c4 ceph]# s3cmd mb s3://first_bucketBucket 's3://first_bucket/' created[root@c4 ceph]# s3cmd -v ls2019-04-25 08:40 s3://first_bucket[root@c4 ceph]# echo "aaaa" > file.txt[root@c4 ceph]# lsMake buckets3cmd mb s3://BUCKETRemove buckets3cmd rb s3://BUCKETList objects or bucketss3cmd ls [s3://BUCKET[/PREFIX]]List all object in all bucketss3cmd laPut file into buckets3cmd put FILE [FILE...] s3://BUCKET[/PREFIX]Get file from buckets3cmd get s3://BUCKET/OBJECT LOCAL_FILE
