第 3 章 使用 odf-cli 命令


odf-cli 命令及其子命令有助于减少重复性任务并提供更好的体验。您可以从客户门户网站下载 odf-cli 工具

3.1. odf get 命令的子命令

odf get recovery-profile

显示为 OSD 设置的 recovery-profile 值。默认情况下,如果没有使用 odf set recovery-profile 命令设置值,则会显示空值。设置值后,会显示适当的值。

示例

$ odf get recovery-profile
# high_recovery_ops
ODF 获取健康状况

检查 Ceph 集群的运行状况和常见配置问题。这个命令检查以下内容:

  • 至少三个 mon pod 在不同的节点上运行
  • mon quorum 和 Ceph 健康详情
  • 至少三个 OSD pod 在不同的节点上运行
  • 所有 pod 的"Running"状态
  • 放置组状态
  • 至少一个 MGR pod 正在运行

    示例

    $ odf get health
    
    Info: Checking if at least three mon pods are running on different nodes
    rook-ceph-mon-a-7fb76597dc-98pxz        Running openshift-storage       ip-10-0-69-145.us-west-1.compute.internal
    rook-ceph-mon-b-885bdc59c-4vvcm Running openshift-storage       ip-10-0-64-239.us-west-1.compute.internal
    rook-ceph-mon-c-5f59bb5dbc-8vvlg        Running openshift-storage       ip-10-0-30-197.us-west-1.compute.internal
    
    Info: Checking mon quorum and ceph health details
    Info: HEALTH_OK
    [...]
ODF get dr-health

在启用了镜像的集群中,从另一个集群获取集群的连接状态。cephblockpool 通过启用了镜像功能查询,如果未找到,则会退出相关日志。

示例

$ odf get dr-health

Info: fetching the cephblockpools with mirroring enabled
Info: found "ocs-storagecluster-cephblockpool" cephblockpool with mirroring enabled
Info: running ceph status from peer cluster
Info:   cluster:
    id:     9a2e7e55-40e1-4a79-9bfa-c3e4750c6b0f
    health: HEALTH_OK

[...]
ODF 获取 dr-prereq

检查并获取所有先决条件的状态,以便在一对集群中启用灾难恢复。该命令取对等集群名称作为参数,并使用它来比较当前的集群配置与对等集群配置。根据比较结果,会显示先决条件的状态。

Example

$ odf get dr-prereq peer-cluster-1

Info: Submariner is installed.
Info: Globalnet is required.
Info: Globalnet is enabled.


odf get mon-endpoints
Displays the mon endpoints
$ odf get dr-prereq peer-cluster-1

Info: Submariner is installed.
Info: Globalnet is required.
Info: Globalnet is enabled.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

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

關於紅帽

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

Theme

© 2026 Red Hat
返回顶部