Ceph

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

2018-04-26  本文已影响11人  chnmagnus

什么是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

步骤

$ 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
host_base = example.com
# 注意:s不能忽略
host_bucket = %(bucket)s.example.com
[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}-
上一篇 下一篇

猜你喜欢

热点阅读