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 集群

  1. 停止使用块设备镜像 RADOS 网关 - 此集群上的 Ceph 对象网关以及任何其他客户端的客户端。
  2. 登录到 Cephadm shell:

    Example

    [root@host01 ~]# cephadm shell

  3. 在继续操作前,集群必须处于健康状态(Health_OK 以及所有的 PG 为 active+clean)。使用客户端密钥环在主机上(如 Ceph 监控器或 OpenStack 控制器节点)运行 ceph status,以确保集群健康。

    Example

    [ceph: root@host01 /]# ceph -s

  4. 如果使用 Ceph 文件系统 (CephFS),请关闭 CephFS 集群:

    语法

    ceph fs set FS_NAME max_mds 1
    ceph fs fail FS_NAME
    ceph status
    ceph fs set FS_NAME joinable false

    Example

    [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

  5. 设置 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 节点上重复。

  6. 如果 MDS 和 Ceph 对象网关节点位于自己的专用节点上,请将其关闭。
  7. 获取守护进程的 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

  8. 禁用包含集群 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".

  9. 停止目标:

    Example

    [root@host01 ~]# systemctl stop ceph-0b007564-ec48-11ee-b736-525400fd02f8.target

    这将停止主机上需要停止的所有守护进程。

  10. 关闭该节点:

    Example

    [root@host01 ~]# shutdown
    Shutdown scheduled for Wed 2024-03-27 11:47:19 EDT, use 'shutdown -c' to cancel.

  11. 对集群的所有节点重复上述步骤。

重新引导 Red Hat Ceph Storage 集群

  1. 如果涉及网络设备,请确保在打开任何 Ceph 主机或节点之前将其开机和稳定。
  2. 打开管理节点。
  3. 启用 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.

  4. 启动 systemd 目标:

    Example

    [root@host01 ~]# systemctl start ceph-0b007564-ec48-11ee-b736-525400fd02f8.target

  5. 等待所有节点上线。验证所有服务都已启动,且节点之间没有网络连接的问题。
  6. 取消设置 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

  7. 如果使用 Ceph 文件系统 (CephFS),请通过将 joinable 标记设置为 true 来使 CephFS 集群重新启动:

    语法

    ceph fs set FS_NAME joinable true

    示例

    [ceph: root@host01 /]# ceph fs set cephfs joinable true

验证

  • 验证集群处于健康状态(Health_OK 和所有 PG active+clean)。在具有客户端密钥环的节点上运行 ceph 状态,如 Ceph 监控器或 OpenStack 控制器节点,以确保集群健康。

Example

[ceph: root@host01 /]# ceph -s

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部