@dyj2017
2017-10-30T10:41:19.000000Z
字数 1723
阅读 6557
ceph
ceph运维
pool
ceph的pool有两种类型,一种是副本池,一种是ec池,创建时也有所区别
$ sudo ceph osd pool create pool-name pg_num pgp_num
如:
[root@node3 ~]# ceph osd pool create testpool 128 128
pool 'testpool' created
$ sudo ceph osd pool create pool-name pg_num pgp_num erasure
如:
[root@node3 ~]# ceph osd pool create ecpool 12 12 erasure
pool 'ecpool' created
[root@node3 ~]# ceph osd lspools
2 testpool,4 ecpool,
或
[root@node3 ~]# rados lspools
testpool
ecpool
两个命令的区别就是第一个可以查看pool的id
[root@node3 ~]# ceph osd pool ls detail
pool 2 'testpool' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 128 pgp_num 128 last_change 46 flags hashpspool stripe_width 0
pool 4 'ecpool' erasure size 3 min_size 3 crush_rule 1 object_hash rjenkins pg_num 12 pgp_num 12 last_change 55 flags hashpspool stripe_width 8192
或
[root@node3 ~]# ceph osd dump|grep pool
pool 2 'testpool' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 128 pgp_num 128 last_change 46 flags hashpspool stripe_width 0
pool 4 'ecpool' erasure size 3 min_size 3 crush_rule 1 object_hash rjenkins pg_num 12 pgp_num 12 last_change 55 flags hashpspool stripe_width 8192
可以看出两个命令输出内容是一样的
[root@node3 ~]# rados df
POOL_NAME USED OBJECTS CLONES COPIES MISSING_ON_PRIMARY UNFOUND DEGRADED RD_OPS RD WR_OPS WR
ecpool 0 0 0 0 0 0 0 0 0 0 0
testpool 0 0 0 0 0 0 0 0 0 0 0
total_objects 0
total_used 6386M
total_avail 55053M
total_space 61440M
$ sudo ceph osd pool delete {pool-name} {pool-name} --yes-i-really-really-mean-it
如:
[root@node3 ~]# ceph osd pool delete ecpool ecpool --yes-i-really-really-mean-it
pool 'ecpool' removed
如果删除pool时提示error请参考: 删除pool error的解决方法
$ sudo ceph osd pool get {pool-name} {key}
如获取副本池的副本数:
[root@node3 ~]# ceph osd pool get testpool size
size: 3
$ sudo ceph osd pool set {pool-name} {key} {value}
如设置副本池的副本数:
[root@node3 ~]# ceph osd pool set testpool size 2
set pool 2 size to 2