PG degraded实验
1. 创建一个文件,并把该文件作为对象放到集群中:
[root@node1 ~]# echo "this is test! " >>test.txt
[root@node1 ~]# rados -p testpool ls
[root@node1 ~]# rados -p testpool put test.txt test.txt
[root@node1 ~]# rados -p testpool ls
test.txt
2. 查看该对象对应的pg号以及osd组:
[root@node1 ~]# ceph osd map testpool test.txt
osdmap e76 pool 'testpool' (2) object 'test.txt' -> pg 2.8b0b6108 (2.8) -> up ([1,2,0], p1) acting ([1,2,0], p1)
3. 踢除主osd,pg降级,次osd升级为临时主osd:
[root@node2 ~]# systemctl stop ceph-osd@1
[root@node2 ~]# ceph osd map testpool test.txt
osdmap e79 pool 'testpool' (2) object 'test.txt' -> pg 2.8b0b6108 (2.8) -> up ([2,0], p2) acting ([2,0], p2)
[root@node2 ~]# ceph pg dump_stuck |grep ^2.8
2.8 active+undersized+degraded [2,0] 2 [2,0] 2
4. 此时仍能够访问该对象:
[root@node2 ~]# rados -p testpool get test.txt test.txt
[root@node2 ~]# cat test.txt
this is test!
5. 恢复原主osd:
[root@node2 ~]# systemctl start ceph-osd@1
[root@node2 ~]# ceph pg dump_stuck |grep ^2.8
ok
[root@node2 ~]# ceph osd map testpool test.txt
osdmap e82 pool 'testpool' (2) object 'test.txt' -> pg 2.8b0b6108 (2.8) -> up ([1,2,0], p1) acting ([1,2,0], p1)
通过上面的实验可以看出,当承载同一个pg的osd中的主osd out,次osd会临时升任主osd。在一定的时间间隔内,如果主osd up,该osd继续其主osd功能。
参考文献:
posted on 2017-10-24 15:35 sisimi_2017 阅读(421) 评论(0) 编辑 收藏 举报