Red Hat Training

A Red Hat training course is available for Red Hat Ceph Storage

4.5. 压缩 monitor 存储

当 monitor 存储的大小增大时,您可以对其进行压缩:

重要

当集群不处于 active+clean 状态或重新平衡过程中,监控器存储大小更改。因此,在完成重新平衡时,压缩 monitor 存储。另外,确保 PG 处于 active+clean 状态。

步骤:动态压缩 monitor 存储

要在 ceph-mon 守护进程运行时压缩 monitor 存储:

ceph tell mon.<host-name> compact

使用运行 ceph-mon 的主机的短主机名替换 <host-name>。不确定时使用 hostname -s 命令。

# ceph tell mon.host1 compact

步骤:在启动时压缩 monitor 存储

  1. 将以下参数添加到 Ceph 配置的 [mon] 部分下:

    [mon]
    mon_compact_on_start = true
  2. 重启 ceph-mon 守护进程:

    systemctl restart ceph-mon@<host-name>

    使用运行守护进程的主机的短名称替换 <host-name>。不确定时使用 hostname -s 命令。

    # systemctl restart ceph-mon@host1
  3. 确保 monitor 创建了仲裁:

    # ceph mon stat
  4. 如果需要,在其他 monitor 上重复这些步骤。

步骤:使用压缩 monitor 存储 ceph-monstore-tool

注意

在开始前,请确保已安装了 ceph-test 软件包。

  1. 验证带有大存储的 ceph-mon 守护进程没有运行。如果需要,请停止 后台程序。

    systemctl status ceph-mon@<host-name>
    systemctl stop ceph-mon@<host-name>

    使用运行守护进程的主机的短名称替换 <host-name>。不确定时使用 hostname -s 命令。

    # systemctl status ceph-mon@host1
    # systemctl stop ceph-mon@host1
  2. 紧凑 monitor 存储:

    ceph-monstore-tool /var/lib/ceph/mon/mon.<host-name> compact

    使用 monitor 主机的短主机名替换 <host-name>

    # ceph-monstore-tool /var/lib/ceph/mon/mon.node1 compact
  3. 再次启动 ceph-mon

    systemctl start ceph-mon@<host-name>

    例如:

    # systemctl start ceph-mon@host1

另请参阅