手动增加ceph对象网关(可在一个节点增加多个网关)
以下步骤建议在centos 子用户下进行,不建议在root用户下
1、安装radosgw
若已安装,请自行跳过此步骤
yum -y install ceph-radosgw
2、创建keyring
sudo ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring
3、修改文件权限
sudo chown ceph:ceph /etc/ceph/ceph.client.radosgw.keyring
4、生成ceph-radosgw服务对应的用户和Key
sudo ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n 用户名 --gen-key
例:用户名为client.rgw.ceph-node1-1
sudo ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n client.rgw.ceph-node1-1 --gen-key
5、为用户添加访问权限
sudo ceph-authtool -n client.rgw.ceph-node1-1 --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.keyring
6、导入keyring到集群中
sudo ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.rgw.ceph-node1-1 -i /etc/ceph/ceph.client.radosgw.keyring
7、查看集群中是否已有对应的用户
ceph auth list
8、配置ceph.conf
vi /etc/ceph/ceph.conf
在配置文件中增加以下内容
[client.rgw.ceph-node1-1]
host=ceph-node1
keyring=/etc/ceph/ceph.client.radosgw.keyring
log file=/var/log/radosgw/client.radosgw.gateway.log
rgw_s3_auth_use_keystone = False
rgw_frontends = civetweb port=7481
9、创建日志目录并修改权限
mkdir /var/log/radosgw
chown ceph:ceph /var/log/radosgw
10、启动rgw并查看状态
systemctl start ceph-radosgw@rgw.ceph-node1-1
systemctl restart ceph-radosgw.target
systemctl status ceph-radosgw@rgw.ceph-node1-1
netstat -antpu | grep 7481
11、设置rgw开机启动
systemctl enable ceph-radosgw@rgw.ceph-node1-1
12、验证
curl http://主机名:端口号
返回
<?xml version="1.0" encoding="UTF-8"?><ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>anonymous</ID><DisplayName></DisplayName></Owner><Buckets></Buckets></ListAllMyBucketsResult>