一个Ceph集群需要多个Monitor组成的小集群,它们通过Paxos同步数据,用来保存OSD的元数据。
$ ceph mon stat
e1: 3 mons at {ceph-xx-osd00=10.69.0.1:6789/0,ceph-xx-osd01=10.69.0.2:6789/0,ceph-xx-osd02=10.69.0.3:6789/0}, election epoch 52, leader 0 ceph-xx-osd01, quorum 0,1,2 ceph-xx-osd01,ceph-xx-osd00,ceph-xx-osd02
$ ceph quorum_status
{"election_epoch":52,"quorum":[0,1,2],"quorum_names":["ceph-xx-osd01","ceph-xx-osd00","ceph-xx-osd02"],"quorum_leader_name":"ceph-xx-osd01","monmap":{"epoch":1,"fsid":"97219550-d917-4154-b745-32bac14f99f2","modified":"2017-08-31 16:14:09.434281","created":"2017-08-31 16:14:09.434281","features":{"persistent":["kraken","luminous"],"optional":[]},"mons":[{"rank":0,"name":"ceph-xx-osd01","addr":"10.69.0.2:6789/0","public_addr":"10.69.0.2:6789/0"},{"rank":1,"name":"ceph-xx-osd00","addr":"10.69.0.3:6789/0","public_addr":"10.69.0.3:6789/0"},{"rank":2,"name":"ceph-xx-osd02","addr":"10.69.0.3:6789/0","public_addr":"10.69.0.3:6789/0"}]}}
$ ceph mon dump
dumped monmap epoch 1
epoch 1
fsid 97219550-d917-4154-b745-32bac14f99f2
last_changed 2017-08-31 16:14:09.434281
created 2017-08-31 16:14:09.434281
0: 10.69.0.2:6789/0 mon.ceph-xx-osd01
1: 10.69.0.3:6789/0 mon.ceph-xx-osd00
2: 10.69.0.1:6789/0 mon.ceph-xx-osd02
$ ceph mon remove ceph-xx-osd01
removing mon.ceph-xx-osd01 at 10.69.0.2:6789/0, there will be 2 monitors
$ ceph mon dump
dumped monmap epoch 2
epoch 2
fsid 97219550-d917-4154-b745-32bac14f99f2
last_changed 2017-11-23 17:06:35.075538
created 2017-08-31 16:14:09.434281
0: 10.69.0.3:6789/0 mon.ceph-xx-osd00
1: 10.69.0.1:6789/0 mon.ceph-xx-osd02
$ ceph mon add ceph-xx-osd01 10.69.0.2:6789
adding mon.ceph-xx-osd01 at 10.69.0.2:6789/0
$ ceph mon dump
dumped monmap epoch 3
epoch 3
fsid 97219550-d917-4154-b745-32bac14f99f2
last_changed 2017-11-23 17:07:39.789494
created 2017-08-31 16:14:09.434281
0: 10.69.0.2:6789/0 mon.ceph-xx-osd01
1: 10.69.0.4:6789/0 mon.ceph-xx-osd00
2: 10.69.0.3:6789/0 mon.ceph-xx-osd02
$ ceph mon getmap -o 1.txt
got monmap epoch 3
$ monmaptool --print 1.txt
monmaptool: monmap file 1.txt
epoch 3
fsid 97219550-d917-4154-b745-32bac14f99f2
last_changed 2017-11-23 17:07:39.789494
created 2017-08-31 16:14:09.434281
0: 10.69.0.2:6789/0 mon.ceph-xx-osd01
1: 10.69.0.4:6789/0 mon.ceph-xx-osd00
2: 10.69.0.3:6789/0 mon.ceph-xx-osd02
$ ceph mon getmap -o 1.txt
got monmap epoch 3
$ monmaptool --print 1.txt
monmaptool: monmap file 1.txt
epoch 3
fsid 97219550-d917-4154-b745-32bac14f99f2
last_changed 2017-11-23 17:07:39.789494
created 2017-08-31 16:14:09.434281
0: 10.69.0.2:6789/0 mon.ceph-xx-osd01
1: 10.69.0.4:6789/0 mon.ceph-xx-osd00
2: 10.69.0.3:6789/0 mon.ceph-xx-osd02
$ ceph-mon -i node4 -inject-monmap 1.txt
$ ceph-conf --name mon.ceph-xx-osd00 --show-config-value admin_socket
/var/run/ceph/ceph-mon.ceph-xx-osd00.asok
$ ceph daemon mon.ceph-xx-osd00 mon_status
#登陆对应mon的机器,停止mon进程
systemctl stop ceph-mon.target
#检查Mon的状态
ceph mon stat