ceph集群移除osd,mon,mdr,mds节点

移除osd节点

查看当前osd状态

1
2
3
4
5
6
7
8
9
10
11
$ ceph osd tree
ID CLASS WEIGHT TYPE NAME STATUS REWEIGHT PRI-AFF
-1 9.74405 root default
-9 0.95409 host bank1
3 hdd 0.95409 osd.3 up 1.00000 1.00000
-3 5.99799 host vm01
0 hdd 5.99799 osd.0 up 1.00000 1.00000
-5 1.81929 host vm02
1 hdd 1.81929 osd.1 up 1.00000 1.00000
-7 0.97269 host web
2 hdd 0.97269 osd.2 up 1.00000 1.00000

将osd标记为out,准备踢出集群,{osd-num}为osd编号,比如osd.2

1
$ ceph osd out {osd-num}

集群会进行重新平衡和数据迁移,查看

1
$ ceph -w

ceps -s也可以查看进度,当完成时集群状态会重新回归到actice+clean状态
如果卡在active+clean+remapped或者active+remapped状态,先将osd回归集群

1
$ ceph osd in {osd-num}

等集群恢复到active+clean状态后,执行

1
$ ceph osd crush reweight osd.{osd-num} 0

等集群状态再次变成active+clean状态后,将osd标记为out,并停止ceph-osd服务

1
2
$ ceph osd out {osd-num}
$ sudo systemctl stop ceph-osd@2.service

移除osd

1
2
$ ceph osd purge osd.{osd-num} --yes-i-really-mean-it
purged osd.2

移除mon节点

1
$ ceph mon remove {mon-name}

移除mgr节点
在将要被移除的mgr节点上执行

1
2
3
$ sudo systemctl stop ceph-mgr@{mgr-name}
$ sudo systemctl disable ceph-mgr@{mgr-name}
$ sudo rm -rf /var/lib/ceph/mgr/ceph-{mgr-name}

移除mds节点
在将要被移除的mds节点上执行

1
2
3
$ sudo systemctl stop ceph-mds@{mds-name}
$ sudo systemctl disable ceph-mds@{mds-name}
$ sudo rm -rf /var/lib/ceph/mds/ceph-{mds-name}

References:
[1]ADDING/REMOVING OSDS
[2]DEPLOYING METADATA SERVERS