创建,查看,删除pool,查看,修改pool参数命令总结

时间:2023-03-10 03:30:06
创建,查看,删除pool,查看,修改pool参数命令总结

标签(空格分隔): ceph,ceph运维,pool


1. 创建pool命令:

ceph的pool有两种类型,一种是副本池,一种是ec池,创建时也有所区别

1.1 创建副本池:

$ sudo ceph osd pool create pool-name pg_num pgp_num

如:

[root@node3 ~]# ceph osd pool create testpool 128 128
pool 'testpool' created

1.2 创建ec池:

$ 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

2. 查看pool命令

查看pool命令:

[root@node3 ~]# ceph osd lspools
2 testpool,4 ecpool,

[root@node3 ~]# rados lspools
testpool
ecpool

两个命令的区别就是第一个可以查看pool的id

查看pool的详细配置信息:

[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

可以看出两个命令输出内容是一样的

查看pool的用量信息:

[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

3. 删除pool命令

$ 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的解决方法

4. 获取pool参数:

$ sudo ceph osd pool get {pool-name} {key}

如获取副本池的副本数:

[root@node3 ~]# ceph osd pool get testpool size
size: 3

5. 设置pool参数:

$ sudo ceph osd pool set  {pool-name} {key} {value}

如设置副本池的副本数:

[root@node3 ~]# ceph osd pool set testpool size 2
set pool 2 size to 2