配置s3-tests s3cmd 以subdomain方式访问rgw

什么是subdomain方式

rgw提供s3 rest接口进行数据读写,有两种方式:
subdomain方式:<bucket>.example.com
ordinary方式:example.com/<bucket>

环境

假设rgw所在机器ip 为10.0.0.1
用另一台机器运行s3-tests,假设ip为10.0.0.2

步骤

  • 为rgw配置rgw dns name配置项
    修改ceph.conf,增加rgw dns name = example.com配置项,然后重启radosgw
  • 为s3-tests和s3cmd所在机器配置example.com的泛域名解析
$ yum install dnsmasq

$ vim /etc/dnsmasq.conf
$ cat /etc/dnsmasq.conf
listen-address=127.0.0.1
address=/.example.com/10.0.0.1
cache-size=2048
resolv-file=/etc/dnsmasq.resolv.conf

$ cp /etc/resolv.conf /etc/dnsmasq.resolv.conf
$ vim /etc/resolv.conf
$ cat /etc/resolv.conf
nameserver 127.0.0.1

systemctl start dnsmasq
nscd -i hosts

# test
curl a.example.com
curl example.com
  • 配置s3cmd
    在.s3cfg中修改两项:
host_base = example.com
# 注意:s不能忽略
host_bucket = %(bucket)s.example.com
  • 配置s3-tests
    修改S3TEST_CONF对应的配置文件
[DEFAULT]
host = example.com
port = 80
is_secure = no
calling_format = subdomain
[fixtures]
# 注意:bucket的完整name一定不能以'-'结尾
# 在这里,如果s3tests不能正确为bucket prefix追加结尾,
# 会导致s3-tests-{random}-.example的域名无法解析。
bucket prefix = s3-tests-{random}-
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容