[关闭]
@dyj2017 2017-10-30T10:41:19.000000Z 字数 1723 阅读 6521

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

ceph ceph运维 pool


1. 创建pool命令:

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

1.1 创建副本池:

  1. $ sudo ceph osd pool create pool-name pg_num pgp_num

如:

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

1.2 创建ec池:

  1. $ sudo ceph osd pool create pool-name pg_num pgp_num erasure

如:

  1. [root@node3 ~]# ceph osd pool create ecpool 12 12 erasure
  2. pool 'ecpool' created

2. 查看pool命令

查看pool命令:

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

  1. [root@node3 ~]# rados lspools
  2. testpool
  3. ecpool

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

查看pool的详细配置信息:

  1. [root@node3 ~]# ceph osd pool ls detail
  2. 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
  3. 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

  1. [root@node3 ~]# ceph osd dump|grep pool
  2. 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
  3. 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的用量信息:

  1. [root@node3 ~]# rados df
  2. POOL_NAME USED OBJECTS CLONES COPIES MISSING_ON_PRIMARY UNFOUND DEGRADED RD_OPS RD WR_OPS WR
  3. ecpool 0 0 0 0 0 0 0 0 0 0 0
  4. testpool 0 0 0 0 0 0 0 0 0 0 0
  5. total_objects 0
  6. total_used 6386M
  7. total_avail 55053M
  8. total_space 61440M

3. 删除pool命令

  1. $ sudo ceph osd pool delete {pool-name} {pool-name} --yes-i-really-really-mean-it

如:

  1. [root@node3 ~]# ceph osd pool delete ecpool ecpool --yes-i-really-really-mean-it
  2. pool 'ecpool' removed

如果删除pool时提示error请参考: 删除pool error的解决方法

4. 获取pool参数:

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

如获取副本池的副本数:

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

5. 设置pool参数:

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

如设置副本池的副本数:

  1. [root@node3 ~]# ceph osd pool set testpool size 2
  2. set pool 2 size to 2
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注