zoukankan      html  css  js  c++  java
  • ceph中pool的管理

    1、创建pool

    创建ceph pool的命令如下,它的参数包括pool名字、PG和PGP的数量。

    • 若少于5个OSD, 设置pg_num为128。

    • 5~10个OSD,设置pg_num为512。

    • 10~50个OSD,设置pg_num为4096。

    ceph osd pool create mytest 128 128
    pool 'mytest' created

    2、列出所有pool

    rados lspools
    ceph osd lspools

    使用ceph osd pool ls detail查看每个pool的详细信息

    root@ceph01:~/mir2_data# ceph osd pool ls detail
    pool 7 'rbd' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 188 flags hashpspool max_bytes 300647710720 stripe_width 0
        removed_snaps [1~3]
    pool 8 'hzb' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 151 flags hashpspool stripe_width 0
    pool 9 'cephfs_data' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 100 pgp_num 100 last_change 157 flags hashpspool crash_replay_interval 45 stripe_width 0
    pool 10 'cephfs_metadata' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 100 pgp_num 100 last_change 155 flags hashpspool stripe_width 0

    3、设置pool的配额

    设置允许最大object数量为100:

    ceph osd pool set-quota mytest max_objects 100

    设置允许容量限制为10GB:

    ceph osd pool set-quota mytest max_bytes $((10 * 1024 * 1024 * 1024))

    取消配额限制只需要把对应值设为0即可。

    4、删除pool

    ceph osd pool delete hzb-test hzb-test --yes-i-really-really-mean-it

    注意:hzb-test是pool的名称,要写两次

    5、重命名pool

    ceph osd pool rename {current-pool-name} {new-pool-name}

    6、查看pool状态信息

    root@ceph01:~/my-cluster# rados df
    pool name                 KB      objects       clones     degraded      unfound           rd        rd KB           wr        wr KB
    hzbtest                    0            0            0            0            0            0            0            0            0
    rbd                        1            1            0            0            0          577         1283          631        13236
      total used        10557768            1
      total avail      303859392
      total space      314417160

    7、创建和删除快照

    ceph osd pool mksnap rbd rbd-snap
    ceph osd pool rmsnap rbd rbd-snap

    8、设置pool的key

    通过以下语法设置pool的元数据:

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

    比如设置pool的冗余副本数量为3:

    ceph osd pool set test-pool size 3

    设置pool

    通过以下语法设置pool的元数据:

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

    比如设置pool的冗余副本数量为3:

    ceph osd pool set test-pool size 3

    你可以设置下列键的值:
    1)size
    设置存储池中对象的副本数。
    Type: Integer


    2)min_size
    设置 IO 需要的最小副本数。
    Type: Integer

    3)crash_replay_interval
    允许客户端重放确认而未提交请求的秒数。
    Type: Integer


    4)pgp_num
    计算数据归置时使用的有效归置组数量。
    Type: Integer

    5)crush_ruleset
    集群内映射对象归置时使用的规则集。
    Type: Integer

    通过get操作能够获取pool的配置值,比如获取当前pg_num:

    ceph osd pool get test-pool pg_num

    获取当前副本数:

    ceph osd pool get test-pool size
  • 相关阅读:
    一行code实现ADO.NET查询结果映射至实体对象。
    傻瓜式使用AutoFac
    Asp.Net MVC中捕捉错误路由并设置默认Not Found页面。
    asp.net MVC中实现调取web api
    JavaScript_11_验证
    JavaScript_10_错误
    JavaScript_9_循环
    JavaScript_8_比较,条件语句
    JavaScript_7_运算符
    JavaScript_6_函数
  • 原文地址:https://www.cnblogs.com/boshen-hzb/p/6739368.html
Copyright © 2011-2022 走看看