Configuring a secondary zone
In RGW, multi-site zones replicate all data within a zone group to ensure that each zone has the same set data. In this section, you will be configuring the secondary zone. You should be using the us-west-1 RGW instance to configure your secondary zone:
- Create an RGW keyring in the /etc/ceph path and check if you are able to access the cluster with user RGW Cephx:
# cp /var/lib/ceph/radosgw/ceph-rgw.us-west-1/
keyring /etc/ceph/ceph.client.rgw.us-west-1.keyring
# cat /etc/ceph/ceph.client.rgw.us-west-1.keyring
# ceph -s --id rgw.us-west-1

You should be running the following steps in the secondary site RGW node us-west-1:
- First of all, you need to pull the RGW realm.
You need to use the RGW endpoint URL path and the access key and secret key of the master zone in the master zone group to pull the realm to the secondary zone RGW node:
# radosgw-admin realm pull
--url=http://us-east-1.cephcookbook.com:8080
--access-key=ZYCDNTEASHKREV4X9BUJ
--secret=4JbC4OC4vC6fy6EY6Pfp8rPZMrpDnYmETZxNyyu9
--id rgw.us-west-1

- As this is the default realm for this RGW multi-site setup, you need to make it default:
# radosgw-admin realm default --rgw-realm=cookbookv2
--id rgw.us-west-1
- You need to pull the period from the master site, because you need to get the latest version of the zone group and zone configurations for the realm:
# radosgw-admin period pull
--url=http://us-east-1.cephcookbook.com:8080
--access-key=ZYCDNTEASHKREV4X9BUJ
--secret=4JbC4OC4vC6fy6EY6Pfp8rPZMrpDnYmETZxNyyu9
--id rgw.us-west-1
- Create a secondary zone. Your secondary zone RGW node is us-west-1 and you need to run the following command in the secondary zone RGW node us-west-1:
# radosgw-admin zone create --rgw-zonegroup=us
--rgw-zone=us-west-1 --access-key=ZYCDNTEASHKREV4X9BUJ
--secret=4JbC4OC4vC6fy6EY6Pfp8rPZMrpDnYmETZxNyyu9
--endpoints=http://us-west-1.cephcookbook.com:8080
--id rgw.us-west-1

- Remove the default zone from the secondary site, as you are not using it:
# radosgw-admin zone delete --rgw-zone=default
--id rgw.us-west-1
- Finally, update the period on the secondary site:
# radosgw-admin period update --commit
--id rgw.us-west-1
- Remove the RGW default pools:
# for i in `ceph osd pool ls --id rgw.us-west-1 |
grep default.rgw`; do ceph osd pool delete $i $i
--yes-i-really-really-mean-it --id rgw.us-west-1; done

- You also need to update the [client.rgw.us-west-1] section of ceph.conf with the rgw_zone=us-west-1 option:

- Then, restart the us-west-1 RGW daemon:
# systemctl restart ceph-radosgw.target
With this, you have both the master and secondary site up and running with active-active asynchronous replication, and now you can check the synchronization status on both of the sites.