DNS-Style Buckets with Multiple Domains
Problem
The RGW supports two URL methods to specify the bucket name used for an operation:
- Path-Style:
https://s3.domain.com/bucketname/path/to/object
- DNS-Style (aka Virtual Hosted-Style):
https://bucketname.s3.domain.com/path/to/object
In order to support DNS-style buckets, the RGW is normally configured using:
# ceph config set rgw rgw_dns_name s3.domain.com
# ceph config set rgw rgw_dns_s3website_name s3-website.domain.com
But if a user wants to configure multiple domains for DNS-style buckets, an alternate configuration must be used.
Solution
Set the hostname
and hostname_s3_website
fields in the zonegroup, for example:
# radosgw-admin zonegroup get | tee zonegroup.txt
{
"id": "c294f981-1dc9-4af3-9a56-3a8ae0f44c89",
"name": "default",
"api_name": "default",
"is_master": "true",
"endpoints": [],
"hostnames": [],
...
# vim zonegroup.txt # edit the hostnames field accordingly (see below).
# radosgw-admin zonegroup set < zonegroup.txt
# radosgw-admin zonegroup get
{
"id": "c294f981-1dc9-4af3-9a56-3a8ae0f44c89",
"name": "default",
"api_name": "default",
"is_master": "true",
"endpoints": [],
"hostnames": [
"s3.domain1.com",
"s3.domain2.com",
"s3.domain3.com"
],
...
#
Finally, restart all RGW daemons:
# ceph orch ps
# ceph orch daemon restart <rgw>