在最初使用ceph的时候就有一个疑问,ceph存储时将对象映射到PG(Placement Groups)中,然后以PG为单位,遵循CRUSH的规则分布到OSD中,那么PGP又是什么?因此决定自己探索一下。
文章目录
ceph对象的映射关系架构图
环境介绍
[root@ceph01 my-cluster]# ceph osd tree
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 0.57088 root default
-2 0.19029 host ceph02
0 0.19029 osd.0 up 1.00000 1.00000
-3 0.19029 host ceph03
1 0.19029 osd.1 up 1.00000 1.00000
-4 0.19029 host ceph01
2 0.19029 osd.2 up 1.00000 1.00000
操作验证
1.创建test_pool
[root@ceph01 my-cluster]# ceph osd pool create test_pool 6 6
pool 'test_pool' created
2.查看创建之后的PG分布情况
使用命令
[root@ceph01 my-cluster]# ceph pg ls-by-pool test_pool | awk '{print $1,$2,$15}'
pg_stat objects up_primary
10.0 0 [2,0]
10.1 0 [0,2]
10.2 0 [1,2]
10.3 0 [0,2]
10.4 0 [1,2]
10.5 0 [1,2]
可以看出test_pool的pg都是以10开头的。然后也可以用其他命令查询PG的分布情况,如下:
[root@ceph01 my-cluster