Ceph多数据中心(容灾)

# A集群操作
# 创建realm
docker exec mon radosgw-admin realm create --rgw-realm=earth –default
# 删除默认zonegroup
docker exec mon radosgw-admin zonegroup delete --rgw-zonegroup=default
# 创建zonegroup
docker exec mon radosgw-admin zonegroup create --rgw-zonegroup=chian --endpoints=http://10.36.3.113:8080 --rgw-realm=earth --master –default
# 删除默认zone
docker exec mon radosgw-admin zone delete --rgw-zone=default
# 创建zone
docker exec mon radosgw-admin zone create --rgw-zonegroup=china --rgw-zone=huabei --master --default --endpoints=http://10.36.3.113:8080
# 创建系统用户
docker exec mon radosgw-admin user create --uid="synchronization-user" --display-name="Synchronization User" –system
"keys": [
        {
            "user": "synchronization-user",
            "access_key": "WCR8GIZBL38KW5SYIX6N",
            "secret_key": "8OJGJl5LUVNZfQBtErMpmYVXIkiZBboceUlULXQT"
        }
]
# 将系统用户添加到zone
docker exec mon radosgw-admin zone modify --rgw-zone=huabei --access-key=WCR8GIZBL38KW5SYIX6N --secret=8OJGJl5LUVNZfQBtErMpmYVXIkiZBboceUlULXQT
# 更新period
docker exec mon radosgw-admin period update –commit
# 更新ceph配置文件(添加以下内容到ceph.conf)
[client.rgw.localhost]
host = 10.36.3.113
rgw frontends = "civetweb port=8080"
rgw_zone=huabei
# 重启rgw
docker restart rgw

# B集群操作
# 拉取realm配置
docker exec mon radosgw-admin realm pull --url=10.36.3.113:8080 --access-key=WCR8GIZBL38KW5SYIX6N --secret=8OJGJl5LUVNZfQBtErMpmYVXIkiZBboceUlULXQT
# 创建zone
docker exec mon radosgw-admin zone create --rgw-zonegroup=china  --rgw-zone=huadong --access-key=WCR8GIZBL38KW5SYIX6N --secret=8OJGJl5LUVNZfQBtErMpmYVXIkiZBboceUlULXQT --endpoints=http://10.36.3.118:8080
# 更新ceph配置文件(添加以下内容到ceph.conf)
[client.rgw.localhost]
host = 10.36.3.118
rgw frontends = "civetweb port=8080"
rgw_zone=huadong
# 更新period
docker exec mon radosgw-admin period update –commit
# 重启rgw
docker restart rgw
# 查看同步状态
[root@localhost ~]# docker exec mon radosgw-admin sync status
          realm 9bdae7af-607c-4971-806b-46b893a3d64e (earth)
      zonegroup 71196f2b-1553-4395-9be9-9b0cb067af85 (china)
           zone f789a036-ee6b-423d-b1b1-5fbc1d36837a (huadong)
  metadata sync syncing
                full sync: 0/64 shards
                incremental sync: 64/64 shards
                metadata is caught up with master
      data sync source: 31670021-85a9-407e-9925-750a7422cad7 (huabei)
                        syncing
                        full sync: 0/128 shards
                        incremental sync: 128/128 shards
                        data is caught up with source
# 在A集群创建普通用户
docker exec mon radosgw-admin user create --uid="testuser" --display-name="First User"
"keys": [
        {
            "user": "testuser",
            "access_key": "SFNK9L679F3WI9QYC7RY",
            "secret_key": "iradWyXS82R64nmyIsqg8mzNeyKofCXgYpNcCMtL"
        }
]

# 在A集群创建桶测试
s3cmd mb s3://test
# 在A集群与B集群上都创建了test桶
# 在A集群上传文件测试
[root@localhost ~]# s3cmd put a.txt s3://test/a.txt
upload: 'a.txt' -> 's3://test/a.txt'  [1 of 1]
 3 of 3   100% in    1s     2.32 B/s  done
# 在B集群下载测试
[root@localhost ~]# s3cmd ls s3://test
2020-03-17 06:11         3   s3://test/a.txt
[root@localhost ~]# s3cmd get s3://test/a.txt a.txt
download: 's3://test/a.txt' -> 'a.txt'  [1 of 1]
 3 of 3   100% in    0s   107.13 B/s  done
[root@localhost ~]# cat a.txt 
ss

# 参考文档
https://docs.ceph.com/docs/master/radosgw/multisite/

你可能感兴趣的:(Ceph多数据中心(容灾))