[关闭]
@dyj2017 2017-10-30T10:38:52.000000Z 字数 1073 阅读 813

pg peered实验

ceph ceph实验 pg


1. 创建一个文件,并把该文件作为对象放到集群中:

  1. [root@node1 ~]# echo "this is test! " >>test.txt
  2. [root@node1 ~]# rados -p testpool ls
  3. [root@node1 ~]# rados -p testpool put test.txt test.txt
  4. [root@node1 ~]# rados -p testpool ls
  5. test.txt

2. 查看该对象对应的pg号以及osd组:

  1. [root@node1 ~]# ceph osd map testpool test.txt
  2. 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.1 osd.0,可以看到pg2.8已经peered:

  1. [root@node2 ~]# systemctl stop ceph-osd@1
  2. [root@node1 ~]# systemctl stop ceph-osd@0
  3. [root@node2 ~]# ceph osd map testpool test.txt
  4. osdmap e88 pool 'testpool' (2) object 'test.txt' -> pg 2.8b0b6108 (2.8) -> up ([2], p2) acting ([2], p2)
  5. [root@node1 ~]# ceph pg dump_stuck|grep ^2.8
  6. 2.8 undersized+degraded+peered [2] 2 [2] 2

此时访问该对象毫无反应,因为pg peered是不能够响应io请求的。但是此时该pg仍有一个副本,却不能够访问了,这是因为testpool的min_size=2,也就是只能允许有一个osd out,如果超过就无法响应io。

4. 修改min_size为1,访问该对象:

  1. [root@node1 ~]# ceph osd pool set testpool min_size 1
  2. set pool 2 min_size to 1
  3. [root@node1 ~]# ceph pg dump_stuck|grep ^2.8
  4. 2.8 active+undersized+degraded [2] 2 [2] 2
  5. [root@node2 ~]# rados -p testpool get test.txt test
  6. [root@node2 ~]# cat test
  7. this is test!

可以看到pg的状态由peered变为了degraded,可以正常访问该对象。

参考文献:

大话Ceph--PG那点事儿

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注