其他分享
首页 > 其他分享> > Ceph 常用命令整理(Monitor)

Ceph 常用命令整理(Monitor)

作者:互联网

查看mon的状态信息

ceph mon stat

[root@ecos75r018-meijia-31-161 ~]# ceph mon state1: 1 mons at {ecos75r018-meijia-31-161=[v2:10.0.31.161:3300/0,v1:10.0.31.161:6789/0]}, election epoch 17, leader 0 ecos75r018-meijia-31-161, quorum 0 ecos75r018-meijia-31-161

这边只配了一台mon节点


查看mon的选举状态

ceph quorum_status -f json-pretty

[root@ecos75r018-meijia-31-161 ~]# ceph quorum_status -f json-pretty

{    "election_epoch": 17,    "quorum": [        0    ],    "quorum_names": [        "ecos75r018-meijia-31-161"    ],    "quorum_leader_name": "ecos75r018-meijia-31-161",    "quorum_age": 172039,    "monmap": {        "epoch": 1,        "fsid": "f60e6370-14ff-44cc-b99c-70b17df8549c",        "modified": "2020-08-12 17:01:25.609741",        "created": "2020-08-12 17:01:25.609741",        "min_mon_release": 14,        "min_mon_release_name": "nautilus",        "features": {            "persistent": [                "kraken",                "luminous",                "mimic",                "osdmap-prune",                "nautilus"            ],            "optional": []        },        "mons": [            {                "rank": 0,                "name": "ecos75r018-meijia-31-161",                "public_addrs": {                    "addrvec": [                        {                            "type": "v2",                            "addr": "10.0.31.161:3300",                            "nonce": 0                        },                        {                            "type": "v1",                            "addr": "10.0.31.161:6789",                            "nonce": 0                        }                    ]                },                "addr": "10.0.31.161:6789/0",                "public_addr": "10.0.31.161:6789/0"            }        ]    }}


查看mon的映射信息

ceph mon dump

[root@ecos75r018-meijia-31-161 ~]# ceph mon dumpdumped monmap epoch 1epoch 1fsid f60e6370-14ff-44cc-b99c-70b17df8549clast_changed 2020-08-12 17:01:25.609741created 2020-08-12 17:01:25.609741min_mon_release 14 (nautilus)0: [v2:10.0.31.161:3300/0,v1:10.0.31.161:6789/0] mon.ecos75r018-meijia-31-161


获得一个正在运行的 mon map,并保存到文件中

ceph mon getmap -o {filename}

[root@ecos75r018-meijia-31-161 ~]# ceph mon getmap -o mon_mapgot monmap epoch 1


查看上面获得的 map

monmaptool --print {filename}

[root@ecos75r018-meijia-31-161 ~]# monmaptool --print mon_mapmonmaptool: monmap file mon_mapepoch 1fsid f60e6370-14ff-44cc-b99c-70b17df8549clast_changed 2020-08-12 17:01:25.609741created 2020-08-12 17:01:25.609741min_mon_release 14 (nautilus)0: [v2:10.0.31.161:3300/0,v1:10.0.31.161:6789/0] mon.ecos75r018-meijia-31-161


把上面的 mon map 注入新加入的节点

ceph-mon -i {node} --inject-monmap {filename}


查看 mon 的 amin socket

ceph-conf --name mon.ecos75r018-meijia-31-161 --show-config-value admin_socket

[root@ecos75r018-meijia-31-161 ~]# ceph-conf --name mon.ecos75r018-meijia-31-161 --show-config-value admin_socket/var/run/ceph/ceph-mon.ecos75r018-meijia-31-161.asok


查看 mon 的详细状态

ceph daemon mon.ecos75r018-meijia-31-161 mon_status

[root@ecos75r018-meijia-31-161 ~]# ceph daemon mon.ecos75r018-meijia-31-161 mon_status{    "name": "ecos75r018-meijia-31-161",    "rank": 0,    "state": "leader",    "election_epoch": 17,    "quorum": [        0    ],    "quorum_age": 172466,    "features": {        "required_con": "2449958747315912708",        "required_mon": [            "kraken",            "luminous",            "mimic",            "osdmap-prune",            "nautilus"        ],        "quorum_con": "4611087854031667199",        "quorum_mon": [            "kraken",            "luminous",            "mimic",            "osdmap-prune",            "nautilus"        ]    },    "outside_quorum": [],    "extra_probe_peers": [],    "sync_provider": [],    "monmap": {        "epoch": 1,        "fsid": "f60e6370-14ff-44cc-b99c-70b17df8549c",        "modified": "2020-08-12 17:01:25.609741",        "created": "2020-08-12 17:01:25.609741",        "min_mon_release": 14,        "min_mon_release_name": "nautilus",        "features": {            "persistent": [                "kraken",                "luminous",                "mimic",                "osdmap-prune",                "nautilus"            ],            "optional": []        },        "mons": [            {                "rank": 0,                "name": "ecos75r018-meijia-31-161",                "public_addrs": {                    "addrvec": [                        {                            "type": "v2",                            "addr": "10.0.31.161:3300",                            "nonce": 0                        },                        {                            "type": "v1",                            "addr": "10.0.31.161:6789",                            "nonce": 0                        }                    ]                },                "addr": "10.0.31.161:6789/0",                "public_addr": "10.0.31.161:6789/0"            }        ]    },    "feature_map": {        "mon": [            {                "features": "0x3ffddff8ffacffff",                "release": "luminous",                "num": 1            }        ],        "mds": [            {                "features": "0x3ffddff8ffacffff",                "release": "luminous",                "num": 1            }        ],        "osd": [            {                "features": "0x3ffddff8ffacffff",                "release": "luminous",                "num": 3            }        ],        "client": [            {                "features": "0x3ffddff8ffacffff",                "release": "luminous",                "num": 2            }        ],        "mgr": [            {                "features": "0x3ffddff8ffacffff",                "release": "luminous",                "num": 1            }        ]    }}


删除一个mon节点


标签:ecos75r018,Monitor,10.0,31,Ceph,meijia,mon,常用命令,161
来源: https://blog.51cto.com/15080020/2654735