2.5. 关闭并重启 Red Hat Ceph Storage 集群
您可以使用两种不同的方法关闭并重启 Red Hat Ceph Storage 集群: systemctl 命令和 Ceph Orchestrator。您可以选择关闭并重启集群的方法。
2.5.1. 使用 systemctl 命令关闭并重启集群 复制链接链接已复制到粘贴板!
您可以使用 systemctl 命令来关闭并重启 Red Hat Ceph Storage 集群。此方法遵循 Linux 停止服务的方式。
前提条件
- 一个正在运行的 Red Hat Ceph Storage 集群。
- 根级别访问权限.
流程
关闭 Red Hat Ceph Storage 集群
- 停止使用块设备镜像 RADOS 网关 - 此集群上的 Ceph 对象网关以及任何其他客户端的客户端。
登录到 Cephadm shell:
Example
[root@host01 ~]# cephadm shell在继续操作前,集群必须处于健康状态(
Health_OK以及所有的 PG 为active+clean)。使用客户端密钥环在主机上(如 Ceph 监控器或 OpenStack 控制器节点)运行ceph status,以确保集群健康。Example
[ceph: root@host01 /]# ceph -s如果使用 Ceph 文件系统 (
CephFS),请关闭CephFS集群:语法
ceph fs set FS_NAME max_mds 1 ceph fs fail FS_NAME ceph status ceph fs set FS_NAME joinable falseExample
[ceph: root@host01 /]# ceph fs set cephfs max_mds 1 [ceph: root@host01 /]# ceph fs fail cephfs [ceph: root@host01 /]# ceph status [ceph: root@host01 /]# ceph fs set cephfs joinable false设置
noout、norecover、norebalance、nobackfill、nodown和pause标志。在使用客户端密钥环的节点上运行以下命令,如 Ceph 监控器或 OpenStack 控制器节点:Example
[ceph: root@host01 /]# ceph osd set noout [ceph: root@host01 /]# ceph osd set norecover [ceph: root@host01 /]# ceph osd set norebalance [ceph: root@host01 /]# ceph osd set nobackfill [ceph: root@host01 /]# ceph osd set nodown [ceph: root@host01 /]# ceph osd set pause重要上例仅用于停止服务和 OSD 节点上的每个 OSD,需要在每个 OSD 节点上重复。
- 如果 MDS 和 Ceph 对象网关节点位于自己的专用节点上,请将其关闭。
获取守护进程的 systemd 目标:
Example
[root@host01 ~]# systemctl list-units --type target | grep ceph ceph-0b007564-ec48-11ee-b736-525400fd02f8.target loaded active active Ceph cluster 0b007564-ec48-11ee-b736-525400fd02f8 ceph.target loaded active active All Ceph clusters and services禁用包含集群 FSID 的目标:
Example
[root@host01 ~]# systemctl disable ceph-0b007564-ec48-11ee-b736-525400fd02f8.target Removed "/etc/systemd/system/multi-user.target.wants/ceph-0b007564-ec48-11ee-b736-525400fd02f8.target". Removed "/etc/systemd/system/ceph.target.wants/ceph-0b007564-ec48-11ee-b736-525400fd02f8.target".停止目标:
Example
[root@host01 ~]# systemctl stop ceph-0b007564-ec48-11ee-b736-525400fd02f8.target这将停止主机上需要停止的所有守护进程。
关闭该节点:
Example
[root@host01 ~]# shutdown Shutdown scheduled for Wed 2024-03-27 11:47:19 EDT, use 'shutdown -c' to cancel.- 对集群的所有节点重复上述步骤。
重新引导 Red Hat Ceph Storage 集群
- 如果涉及网络设备,请确保在打开任何 Ceph 主机或节点之前将其开机和稳定。
- 打开管理节点。
启用 systemd 目标以获取所有正在运行的守护进程:
Example
[root@host01 ~]# systemctl enable ceph-0b007564-ec48-11ee-b736-525400fd02f8.target Created symlink /etc/systemd/system/multi-user.target.wants/ceph-0b007564-ec48-11ee-b736-525400fd02f8.target/etc/systemd/system/ceph-0b007564-ec48-11ee-b736-525400fd02f8.target. Created symlink /etc/systemd/system/ceph.target.wants/ceph-0b007564-ec48-11ee-b736-525400fd02f8.target /etc/systemd/system/ceph-0b007564-ec48-11ee-b736-525400fd02f8.target. 启动 systemd 目标:
Example
[root@host01 ~]# systemctl start ceph-0b007564-ec48-11ee-b736-525400fd02f8.target- 等待所有节点上线。验证所有服务都已启动,且节点之间没有网络连接的问题。
取消设置
noout、norecover、norebalance、nobackfill、nodown和pause标志。在使用客户端密钥环的节点上运行以下命令,如 Ceph 监控器或 OpenStack 控制器节点:示例
[ceph: root@host01 /]# ceph osd unset noout [ceph: root@host01 /]# ceph osd unset norecover [ceph: root@host01 /]# ceph osd unset norebalance [ceph: root@host01 /]# ceph osd unset nobackfill [ceph: root@host01 /]# ceph osd unset nodown [ceph: root@host01 /]# ceph osd unset pause如果使用 Ceph 文件系统 (
CephFS),请通过将joinable标记设置为true来使CephFS集群重新启动:语法
ceph fs set FS_NAME joinable true示例
[ceph: root@host01 /]# ceph fs set cephfs joinable true
验证
-
验证集群处于健康状态(
Health_OK和所有 PGactive+clean)。在具有客户端密钥环的节点上运行ceph 状态,如 Ceph 监控器或 OpenStack 控制器节点,以确保集群健康。
Example
[ceph: root@host01 /]# ceph -s