CEPH Ubuntu14.04 集群删除 OSD 节点

时间:2021-09-16 12:46:30

[问题] 删除 ceph-node1 上的 osd.4 节点的方法?
[解答] 一般步骤是将 osd.4 标记为out, 停止 osd.4 对应的 OSD 服务
, 将 osd.4 从 cursh map中删除,将 osd.4 对应 osd data 和 osd journal销毁
ceph-admin-node@ceph-admin-node:~/my-cluster$ ceph osd tree
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 0.07149 root default
-2 0.02859 host ceph-node2
0 0.01430 osd.0 down 0 1.00000
2 0.01430 osd.2 up 1.00000 1.00000
-3 0.01430 host ceph-node3
1 0.01430 osd.1 down 0 1.00000
-4 0.01430 host ceph-node1
4 0.01430 osd.4 up 1.00000 1.00000
-5 0.01430 host ceph-client-node
3 0.01430 osd.3 up 1.00000 1.00000

ceph-admin-node@ceph-admin-node:~/my-cluster$ ssh ceph-node1
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-31-generic x86_64)

  • Documentation: https://help.ubuntu.com/

    System information as of Sun Feb 26 11:28:25 CST 2017

    System load: 0.43 Processes: 115
    Usage of /: 47.6% of 14.64GB Users logged in: 0
    Memory usage: 26% IP address for eth0: 192.168.1.249
    Swap usage: 0%

    Graph this data and manage this system at:
    https://landscape.canonical.com/

New release ‘16.04.2 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

Last login: Sun Feb 26 11:28:25 2017

将 osd.4 设置为 out 状态

ceph osd out osd.4

停止 ceph-node1 上的 osd.4 的服务进程

sudostopcephosdid=4cephosdstop/waiting ceph osd tree 查看 osd.4 进入到 down 状态。
harvis@ceph-node1:~ cephosdtreeIDWEIGHTTYPENAMEUP/DOWNREWEIGHTPRIMARYAFFINITY10.04289rootdefault20.01430hostcephnode220.01430osd.2up1.000001.0000030.01430hostcephnode330.01430osd.3up1.000001.0000040.01430hostcephnode140.01430osd.4down01.00000osd.4crushmapharvis@cephnode1:  ceph osd tree
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 0.02859 root default
-2 0.01430 host ceph-node2
2 0.01430 osd.2 up 1.00000 1.00000
-3 0.01430 host ceph-node3
3 0.01430 osd.3 up 1.00000 1.00000
-4 0 host ceph-node1
-5 0 host ceph-client-node
0 0 osd.0 down 0 1.00000
1 0 osd.1 down 0 1.00000
4 0 osd.4 down 0 1.00000

执行 auth 删除命令

harvis@ceph-node1:~ cephauthdelosd.4updatedharvis@cephnode1:  ceph osd rm 4
removed osd.4
删除 osd.4 对应的存储目录(这通常是个软链接)
sudo rm -fr /var/lib/ceph/osd/ceph-4
这里对应的实际目录是 /var/local/osd3/ 将它删除掉 sudo rm -fr /var/local/osd3

如果 osd.4 对应的设备,可以使用ceph-disk zap命令将设备恢复到创建分区前的状态(因为ceph-disk zap会删除所有分区包括分区表)

[问题] heartbeat_map reset_timeout ‘OSD::osd_op_tp thread 0x7f104a89a700’ had timed out after 4
[解答]