修改/etc/ceph/ceph.conf文件,加入rados gw監聽的端口python
[client.rgw.rgws] rgw_frontends = "civetweb port=80"
拷貝到各臺機器上,而後在gateway上從新啓動服務。web
若是不知道具體的服務是什麼,能夠經過如下命令查看swift
[root@rgws ~]# systemctl list-units --type=service UNIT LOAD ACTIVE SUB DESCRIPTION auditd.service loaded active running Security Auditing Service ceph-radosgw@rgw.rgws.service loaded active running Ceph rados gateway crond.service loaded active running Command Scheduler dbus.service loaded active running D-Bus System Message Bus
重啓完成,在客戶端應該能經過curl訪問frontend
[root@cephclient ~]# curl http://rgws:80 <?xml version="1.0" encoding="UTF-8"?><ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>anonymous</ID><DisplayName></DisplayName></Owner><Buckets></Buckets></ListAllMyBucketsResult>
客戶端安裝python-botocurl
subscription-manager repos --enable=rhel-7-server-rh-common-rpms sudo yum install python-boto
註冊用戶生成access_key和secret_key測試
radosgw-admin user create --uid="testuser" --display-name="First User" { "user_id": "testuser", "display_name": "First User", "email": "", "suspended": 0, "max_buckets": 1000, "auid": 0, "subusers": [], "keys": [ { "user": "testuser", "access_key": "4BV16CHJPD5T70FMFWFQ", "secret_key": "Q1ijCbo7RGAbWOebxNdimn85IDqc58qYBpTIrC5U" } ], "swift_keys": [], "caps": [], "op_mask": "read, write, delete", "default_placement": "", "placement_tags": [], "bucket_quota": { "enabled": false, "check_on_raw": false, "max_size": -1,
而後創建一個測試文件ui
[root@cephclient ~]# cat s3test.py import boto import boto.s3.connection access_key = "4BV16CHJPD5T70FMFWFQ" secret_key = "Q1ijCbo7RGAbWOebxNdimn85IDqc58qYBpTIrC5U" boto.config.add_section('s3') boto.config.set('s3', 'use-sigv4', 'True') conn = boto.connect_s3( aws_access_key_id = access_key, aws_secret_access_key = secret_key, host = 'rgws', port = 80, is_secure=False, calling_format = boto.s3.connection.OrdinaryCallingFormat(), ) conn.auth_region_name = 'public' bucket = conn.create_bucket('my-new-bucket') for bucket in conn.get_all_buckets(): print "{name}\t{created}".format( name = bucket.name, created = bucket.creation_date, )
測試運行url
[root@cephclient ~]# python s3test.py my-new-bucket 2019-02-24T15:22:53.492Z