ceph问题点
ceph问题点
1.ceph中使用ceph-objectstore-tool将pg从incomplete标记为complete
起始原因是集群中部分osd元数据丢失,导致集群部分pg状态一直为incomplete,从而无法恢复为activate+clean
所以同事介绍之前调研得ceph-objectstore-tool工具来做这样一个pg incomplete状态的恢复
普及一下incomplete状态表示:Peering过程中由于无法选出权威日志或者通过choos_acting选出的acting不足以完成数据恢复,(例如针对纠删码,存活的副本数小于k值)等,导致Peering无法正常完成。即pg元数据丢失,无法恢复pg状态
操作如下:
- 停止出现问题资源池的所有osd
#systemctl stop ceph-osd@id - 先获取当前osd的所有pg数目
#ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op list-pgs
如下3.f7s4 3.f6s1 3.f4s1 3.f2s2 3.ecs3 3.ebs3 3.eas0 3.e0s3 3.des2 3.dbs4 3.d7s0 2.fd 3.d0s1 2.f7 3.5es3 2.f6 - 针对每一个pg进行状态标记
#ceph-objectstore-tool --pgid 6.22 --op mark-complete --data-path /var/lib/ceph/osd/ceph-0/ --type bluestore - 完成所有pg状态的标记之后重启osd
#systemctl start ceph-osd@id
针对以上操作可以实现如下脚本完成:
#!/bin/bash for i in `ceph osd tree down 2>/dev/null |grep -w -A 4 node1 |grep -v node|awk '{print $4}'|sed 's/osd.//g'` #获取当前节点down的osd do ceph osd in osd.$i #将osd标记为in,防止数据迁移 ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-$i/ --op list-pgs > pg."$i" 2>/dev/null #获取当前osd的所有pg并放入对应pg.id文件中 for j in `cat pg."$i"` do ceph-objectstore-tool --pgid $j --op mark-complete --data-path /var/lib/ceph/osd/ceph-$i/ --type bluestore #取出每个pg,标记为complete done done
2.RuntimeError: config file /etc/ceph/ceph.conf exists with different content; use --overwrite-conf to overwrite
#ceph-deploy --overwrite-conf config push ceph-admin ceph-node1 ceph-node2 ceph-node3

浙公网安备 33010602011771号