ceph中使用ceph-objectstore-tool将pg从incomplete标记为complete
生活随笔
收集整理的這篇文章主要介紹了
ceph中使用ceph-objectstore-tool将pg从incomplete标记为complete
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
起始原因是集群中部分osd元數(shù)據(jù)丟失,導(dǎo)致集群部分pg狀態(tài)一直為incomplete,從而無法恢復(fù)為activate+clean
所以同事介紹之前調(diào)研得ceph-objectstore-tool工具來做這樣一個(gè)pg incomplete狀態(tài)的恢復(fù)
普及一下incomplete狀態(tài)表示:Peering過程中由于無法選出權(quán)威日志或者通過choos_acting選出的acting不足以完成數(shù)據(jù)恢復(fù),(例如針對(duì)糾刪碼,存活的副本數(shù)小于k值)等,導(dǎo)致Peering無法正常完成。即pg元數(shù)據(jù)丟失,無法恢復(fù)pg狀態(tài)
操作如下:
- 停止出現(xiàn)問題資源池的所有osd
systemctl stop ceph-osd@id - 先獲取當(dāng)前osd的所有pg數(shù)目
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 - 針對(duì)每一個(gè)pg進(jìn)行狀態(tài)標(biāo)記
ceph-objectstore-tool --pgid 6.22 --op mark-complete --data-path /var/lib/ceph/osd/ceph-0/ --type bluestore - 完成所有pg狀態(tài)的標(biāo)記之后重啟osd
systemctl start ceph-osd@id
針對(duì)以上操作可以實(shí)現(xiàn)如下腳本完成:
#!/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'` #獲取當(dāng)前節(jié)點(diǎn)down的osd
do
ceph osd in osd.$i #將osd標(biāo)記為in,防止數(shù)據(jù)遷移ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-$i/ --op list-pgs > pg."$i" 2>/dev/null #獲取當(dāng)前osd的所有pg并放入對(duì)應(yīng)pg.id文件中for j in `cat pg."$i"`doceph-objectstore-tool --pgid $j --op mark-complete --data-path /var/lib/ceph/osd/ceph-$i/ --type bluestore #取出每個(gè)pg,標(biāo)記為completedone
done
總結(jié)
以上是生活随笔為你收集整理的ceph中使用ceph-objectstore-tool将pg从incomplete标记为complete的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: “密如飘玉屑”上一句是什么
- 下一篇: 鼋头渚门票60岁以上多少钱