B.5. 手动安装 Ceph 对象网关
Ceph 对象网关(也称为 RADOS 网关)是在 librados
API 基础上构建的对象存储接口,为应用提供 Ceph 存储集群的 RESTful 网关。
先决条件
-
正在运行的 Ceph 存储集群,最好处于
active + clean
状态。 - 执行 第 3 章 安装 Red Hat Ceph Storage 的要求 中列出的任务。
流程
启用 Red Hat Ceph Storage 4 Tools 存储库:
[root@gateway ~]# subscription-manager repos --enable=rhceph-4-tools-for-rhel-8-x86_64-debug-rpms
在 Object Gateway 节点上安装
ceph-radosgw
软件包:# yum install ceph-radosgw
在初始 monitor 节点上,执行以下步骤:
更新 Ceph 配置文件,如下所示:
[client.rgw.<obj_gw_hostname>] host = <obj_gw_hostname> rgw frontends = "civetweb port=80" rgw dns name = <obj_gw_hostname>.example.com
其中
<obj_gw_hostname>
是网关节点的短主机名。要查看短主机名,请使用hostname -s
命令。将更新的配置文件复制到新的对象网关节点和 Ceph 存储集群中的所有其他节点:
语法
# scp /etc/ceph/ceph.conf <user_name>@<target_host_name>:/etc/ceph
示例
# scp /etc/ceph/ceph.conf root@node1:/etc/ceph/
将
ceph.client.admin.keyring
文件复制到新的对象网关节点:语法
# scp /etc/ceph/ceph.client.admin.keyring <user_name>@<target_host_name>:/etc/ceph/
示例
# scp /etc/ceph/ceph.client.admin.keyring root@node1:/etc/ceph/
在对象网关节点上,创建数据目录:
# mkdir -p /var/lib/ceph/radosgw/ceph-rgw.`hostname -s`
在对象网关节点上,添加一个用户和密钥环来 bootstrap 对象网关:
语法
# ceph auth get-or-create client.rgw.`hostname -s` osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/ceph-rgw.`hostname -s`/keyring
示例
# ceph auth get-or-create client.rgw.`hostname -s` osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/ceph-rgw.`hostname -s`/keyring
重要为网关密钥提供功能时,您必须提供读取功能。但是,提供 monitor 写入功能是可选的;如果您提供此功能,Ceph 对象网关将能够自动创建池。
在这种情况下,请确保在池中指定合理的 PG 数量。否则,网关使用默认编号,该编号很可能不适合您的需要。有关详细信息,请参阅每个池计算器的 Ceph Placement Group (PG)。
在对象网关节点上,创建
done
文件:# touch /var/lib/ceph/radosgw/ceph-rgw.`hostname -s`/done
在对象网关节点上,更改所有者和组权限:
# chown -R ceph:ceph /var/lib/ceph/radosgw # chown -R ceph:ceph /var/log/ceph # chown -R ceph:ceph /var/run/ceph # chown -R ceph:ceph /etc/ceph
在 Object Gateway 节点上打开 TCP 端口 8080:
# firewall-cmd --zone=public --add-port=8080/tcp # firewall-cmd --zone=public --add-port=8080/tcp --permanent
在对象网关节点上,启动并启用
ceph-radosgw
进程:语法
# systemctl enable ceph-radosgw.target # systemctl enable ceph-radosgw@rgw.<rgw_hostname> # systemctl start ceph-radosgw@rgw.<rgw_hostname>
示例
# systemctl enable ceph-radosgw.target # systemctl enable ceph-radosgw@rgw.node1 # systemctl start ceph-radosgw@rgw.node1
安装后,如果在 monitor 上设置了写入功能,Ceph 对象网关会自动创建池。如需有关手动创建池的详细信息,请参阅存储策略指南中的池章节。
其它资源
- Red Hat Ceph Storage 4 对象网关配置和管理指南