检查mon状态

如果集群中有多个 Mon(很可能),你启动集群后、读写数据前应该检查 Mon 法定人数状态。运行着多个 Mon 时必须形成法定人数,最好周期性地检查 Mon 状态来确定它们在运行。

要查看 Mon map,执行下面的命令:

[root@ceph01 ~]# ceph mon stat
e3: 3 mons at {ceph01=[v2:192.168.11.101:3300/0,v1:192.168.11.101:6789/0],ceph02=[v2:192.168.11.102:3300/0,v1:192.168.11.102:6789/0],ceph03=[v2:192.168.11.103:3300/0,v1:192.168.11.103:6789/0]}, election epoch 1152, leader 0 ceph01, quorum 0,1,2 ceph01,ceph03,ceph02

或者

[root@ceph01 ~]# ceph mon dump
dumped monmap epoch 3
epoch 3
fsid 2a9ebc52-bbba-11ec-ba9b-000c29cbbee8
last_changed 2022-04-14T06:21:26.387306+0000
created 2022-04-14T06:15:54.493770+0000
min_mon_release 15 (octopus)
0: [v2:192.168.11.101:3300/0,v1:192.168.11.101:6789/0] mon.ceph01
1: [v2:192.168.11.103:3300/0,v1:192.168.11.103:6789/0] mon.ceph03
2: [v2:192.168.11.102:3300/0,v1:192.168.11.102:6789/0] mon.ceph02

要检查监视器的法定人数状态,执行下面的命令:

ceph quorum_status -f json-pretty

Ceph 会返回法定人数状态,例如,包含 3 个监视器的 Ceph 集群可能返回下面的:

[root@ceph01 ~]# ceph quorum_status -f json-pretty

{
    "election_epoch": 1154,
    "quorum": [
        0,
        1,
        2
    ],
    "quorum_names": [
        "ceph01",
        "ceph03",
        "ceph02"
    ],
    "quorum_leader_name": "ceph01",
    "quorum_age": 61,
    "features": {
        "quorum_con": "4540138292840890367",
        "quorum_mon": [
            "kraken",
            "luminous",
            "mimic",
            "osdmap-prune",
            "nautilus",
            "octopus"
        ]
    },
    "monmap": {
        "epoch": 3,
        "fsid": "2a9ebc52-bbba-11ec-ba9b-000c29cbbee8",
        "modified": "2022-04-14T06:21:26.387306Z",
        "created": "2022-04-14T06:15:54.493770Z",
        "min_mon_release": 15,
        "min_mon_release_name": "octopus",
        "features": {
            "persistent": [
                "kraken",
                "luminous",
                "mimic",
                "osdmap-prune",
                "nautilus",
                "octopus"
            ],
            "optional": []
        },
        "mons": [
            {
                "rank": 0,
                "name": "ceph01",
                "public_addrs": {
                    "addrvec": [
                        {
                            "type": "v2",
                            "addr": "192.168.11.101:3300",
                            "nonce": 0
                        },
                        {
                            "type": "v1",
                            "addr": "192.168.11.101:6789",
                            "nonce": 0
                        }
                    ]
                },
                "addr": "192.168.11.101:6789/0",
                "public_addr": "192.168.11.101:6789/0",
                "priority": 0,
                "weight": 0
            },
            {
                "rank": 1,
                "name": "ceph03",
                "public_addrs": {
                    "addrvec": [
                        {
                            "type": "v2",
                            "addr": "192.168.11.103:3300",
                            "nonce": 0
                        },
                        {
                            "type": "v1",
                            "addr": "192.168.11.103:6789",
                            "nonce": 0
                        }
                    ]
                },
                "addr": "192.168.11.103:6789/0",
                "public_addr": "192.168.11.103:6789/0",
                "priority": 0,
                "weight": 0
            },
            {
                "rank": 2,
                "name": "ceph02",
                "public_addrs": {
                    "addrvec": [
                        {
                            "type": "v2",
                            "addr": "192.168.11.102:3300",
                            "nonce": 0
                        },
                        {
                            "type": "v1",
                            "addr": "192.168.11.102:6789",
                            "nonce": 0
                        }
                    ]
                },
                "addr": "192.168.11.102:6789/0",
                "public_addr": "192.168.11.102:6789/0",
                "priority": 0,
                "weight": 0
            }
        ]
    }
}

发表评论

后才能评论