创建CephFS 对象网关(RGW)
当前在虚拟机monosd(192.168.10.42)上
上为官网图,下为相关书籍中用图引用。可以进行更为清晰与直观的看到结构!
安装ceph-radosgw
bash> yum install ceph-radosgw -y
bash> vim /etc/ceph/ceph.conf
#新增以下内容#
---
在global下新增
[global]
...
mon max pg per osd = 300
#以下纯新增
[client.rgw01]
host = monosd
keyring = /var/lib/ceph/radosgw/ceph-rgw01/keyring
log file = /var/log/ceph/ceph-radosgw.rgw01.log
rgw frontends = "civetweb port=3245"
---
备选:
[[ certificate.pem文件中包含了证书与私钥 ]]
[[ 如果想多个端口,可以port=3245 port=443s ]]
rgw frontends = "civetweb port=443s ssl_certificate=/etc/ceph/certificate.pem error_log_file=/var/log/civetweb.error.log access_log_file=/var/log/civetweb.access.log"
bash> sudo ceph mkdir -p /var/lib/ceph/radosgw/ceph-rgw01
bash> ceph-authtool -C -n radosgw.rgw01 --gen-key /var/lib/ceph/radosgw/ceph-rgw01/keyring
bash> ceph-authtool -n radosgw.rgw01 --cap mon 'allow rw' --cap osd 'allow rwx' /var/lib/ceph/radosgw/ceph-rgw01/keyring
bash> ceph auth add radosgw.rgw01 --in-file=/var/lib/ceph/radosgw/ceph-rgw01/keyring
bash> chown ceph:ceph /var/lib/ceph/radosgw/ -R
证书生成脚本:将以下内容复制,建立一个crtgen.sh
#!/bin/bash
# create self-signed server certificate:
read -p "Enter your domain: " DOMAIN
echo "Create server key..."
openssl genrsa -des3 -out $DOMAIN.key 2048
echo "Create server certificate signing request..."
#SUBJECT="/C=US/ST=$DOMAIN/L=$DOMAIN/O=$DOMAIN/OU=$DOMAIN/CN=$DOMAIN"
SUBJECT="/CN=$DOMAIN"
openssl req -new -subj $SUBJECT -key $DOMAIN.key -out $DOMAIN.csr
echo "Remove password..."
mv $DOMAIN.key $DOMAIN.origin.key
openssl rsa -in $DOMAIN.origin.key -out $DOMAIN.key
echo "Sign SSL certificate..."
openssl x509 -req -days 3650 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt
echo "Generated:"
echo " $DOMAIN.crt"
echo " $DOMAIN.key"
将crt转换为pem证书,并将地证书与私钥合并:
bash> openssl x509 -in 192.168.10.42.crt -out 192.168.10.42.pem
bash> cat 192.168.10.42.crt > certificate.pem
bash> cat 192.168.10.42.key >> certificate.pem
以上配置完成以后,将三台虚拟机的配置文件同步一下,保持一致,并将之的mon、mgr、osd、mds服务均重启一次
启动服务
bash> systemctl start ceph-radosgw@rgw01
bash> systemctl status ceph-radosgw@rgw01
启动无误以后,添加到开机启动:systemctl enable ceph-radosgw@rgw01
为rgw开启Dashboard管理
bash> radosgw-admin user create --uid=john --display-name="John Doe" --system
bash> radosgw-admin user info --uid=john
bash> ceph dashboard set-rgw-api-access-key 367OXRWXRXIA16189LB0
bash> ceph dashboard set-rgw-api-secret-key grqMG6DD9gONbvljCASmFHwhfO4MMwfHhN4LLDmZ
bash> ceph dashboard set-rgw-api-host monosd
bash> ceph dashboard set-rgw-api-port 3245
bash> ceph dashboard set-rgw-api-scheme http # http or https
bash> ceph dashboard set-rgw-api-admin-resource <admin_resource> #不明,可先不执行
bash> ceph dashboard set-rgw-api-user-id john
bash> ceph dashboard set-rgw-api-ssl-verify False
bash> ceph dashboard set-rest-requests-timeout 30 # seconds
REF.
radosgw.
radhat install rgw.
dashboard.
radosgw-admin.
Ceph 15.25 手动部署系列笔记