搜索

11.2. 查看 Ceph 文件系统的镜像状态

download PDF

Ceph 文件系统(CephFS)镜像守护进程(cephfs-mirror)会获取 CephFS 镜像状态更改的异步通知,以及对等更新。CephFS 镜像模块提供镜像守护进程状态接口,用于检查镜像守护进程状态。如需更多信息,您可以使用命令查询 cephfs-mirror admin socket,以检索镜像状态和对等状态。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 至少部署了一个带有镜像的 Ceph 文件系统。
  • 根级别访问运行 CephFS 镜像守护进程的节点。

流程

  1. 登录到 Cephadm shell:

    示例

    [root@host01 ~]# cephadm shell

  2. 检查 cephfs-mirror 守护进程状态:

    语法

    ceph fs snapshot mirror daemon status

    示例

    [ceph: root@host01 /]# ceph fs snapshot mirror daemon status
    [
      {
        "daemon_id": 15594,
        "filesystems": [
          {
            "filesystem_id": 1,
            "name": "cephfs",
            "directory_count": 1,
            "peers": [
              {
                "uuid": "e5ecb883-097d-492d-b026-a585d1d7da79",
                "remote": {
                  "client_name": "client.mirror_remote",
                  "cluster_name": "remote-site",
                  "fs_name": "cephfs"
                },
                "stats": {
                  "failure_count": 1,
                  "recovery_count": 0
                }
              }
            ]
          }
        ]
      }
    ]

    如需更多信息,请使用 admin socket 接口,如下所示。

  3. 在运行 CephFS 镜像守护进程的节点上查找 Ceph 文件系统 ID:

    语法

    ceph --admin-daemon PATH_TO_THE_ASOK_FILE help

    示例

    [ceph: root@host01 /]# ceph --admin-daemon /var/run/ceph/1011435c-9e30-4db6-b720-5bf482006e0e/ceph-client.cephfs-mirror.node1.bndvox.asok help
    {
        ...
        "fs mirror peer status cephfs@11 1011435c-9e30-4db6-b720-5bf482006e0e": "get peer mirror status",
        "fs mirror status cephfs@11": "get filesystem mirror status",
        ...
    }

    本例中的 Ceph 文件系统 ID 是 cephfs@11

    注意

    当禁用镜像时,文件系统的对应 fs mirror status 命令不会在 help 命令中显示。

  4. 查看镜像状态:

    语法

    ceph --admin-daemon PATH_TO_THE_ASOK_FILE fs mirror status FILE_SYSTEM_NAME@_FILE_SYSTEM_ID

    示例

    [ceph: root@host01 /]# ceph --admin-daemon /var/run/ceph/1011435c-9e30-4db6-b720-5bf482006e0e/ceph-client.cephfs-mirror.node1.bndvox.asok fs mirror status cephfs@11
    {
      "rados_inst": "192.168.0.5:0/1476644347",
      "peers": {
          "1011435c-9e30-4db6-b720-5bf482006e0e": { 1
              "remote": {
                  "client_name": "client.mirror_remote",
                  "cluster_name": "remote-site",
                  "fs_name": "cephfs"
              }
          }
      },
      "snap_dirs": {
          "dir_count": 1
      }
    }

    1
    这是唯一的对等 UUID。
  5. 查看对等状态:

    语法

    ceph --admin-daemon PATH_TO_ADMIN_SOCKET fs mirror status FILE_SYSTEM_NAME@FILE_SYSTEM_ID PEER_UUID

    示例

    [ceph: root@host01 /]# ceph --admin-daemon /var/run/ceph/cephfs-mirror.asok fs mirror peer status cephfs@11 1011435c-9e30-4db6-b720-5bf482006e0e
    {
      "/home/user1": {
          "state": "idle", 1
          "last_synced_snap": {
              "id": 120,
              "name": "snap1",
              "sync_duration": 0.079997898999999997,
              "sync_time_stamp": "274900.558797s"
          },
          "snaps_synced": 2, 2
          "snaps_deleted": 0, 3
          "snaps_renamed": 0
      }
    }

    state 可以是以下三个值之一:

    1
    idle 表示目录当前没有同步。
    2
    syncing 意味着目录当前正在同步。
    3
    failed 表示目录连续失败已达到上限。

默认连续故障数为 10,默认重试间隔为 60 秒。

  1. 显示 cephfs-mirror 守护进程映射到的目录:

    语法

    ceph fs snapshot mirror dirmap FILE_SYSTEM_NAME PATH

    示例

    [ceph: root@host01 /]# ceph fs snapshot mirror dirmap cephfs /volumes/_nogroup/subvol_1
    {
      "instance_id": "25184", 1
      "last_shuffled": 1661162007.012663,
      "state": "mapped"
    }

    1
    instance_id 是与 cephfs-mirror 守护进程关联的 RADOS instance-ID。

    示例

    [ceph: root@host01 /]# ceph fs snapshot mirror dirmap cephfs /volumes/_nogroup/subvol_1
    {
      "reason": "no mirror daemons running",
      "state": "stalled" 1
    }

    1
    stalled 状态表示 CephFS 镜像停滞。

    第二个示例显示了没有镜像守护进程运行时的命令输出。

其它资源

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.