1. 添加root bucket
ceph osd crush add-bucket openstack root
ceph osd crush add-bucket k8s root
ceph osd crush add-bucket cephfs root
ceph osd crush add-bucket rgw root
2. 添加host bucket
ceph osd crush add-bucket openstack-ceph-node-0 host
ceph osd crush add-bucket openstack-ceph-node-1 host
ceph osd crush add-bucket openstack-ceph-node-2 host
ceph osd crush add-bucket k8s-ceph-node-0 host
ceph osd crush add-bucket k8s-ceph-node-1 host
ceph osd crush add-bucket k8s-ceph-node-2 host
ceph osd crush add-bucket cephfs-ceph-node-0 host
ceph osd crush add-bucket cephfs-ceph-node-1 host
ceph osd crush add-bucket cephfs-ceph-node-2 host
ceph osd crush add-bucket rgw-ceph-node-0 host
ceph osd crush add-bucket rgw-ceph-node-1 host
ceph osd crush add-bucket rgw-ceph-node-2 host
3. 添加或移动OSD
格式:
ceph osd crush set {name} {weight} root={root} [{bucket-type}={bucket-name} ...]
说明:
weight为OSD的CRUSH权重,通常其大小以TB为单位。
示例:
ceph osd crush set osd.0 1.0 root=openstack host=openstack-ceph-node-0
4. 常用命令
4.1 调整OSD权重
格式:
ceph osd crush reweight {name} {weight}
4.2 移除OSD
格式:
ceph osd crush remove {name}
4.3 添加bucket
格式:
ceph osd crush add-bucket {bucket-name} {bucket-type}
4.4 移动bucket
格式:
ceph osd crush move {bucket-name} {bucket-type}={bucket-name}, [...]
4.5 移除bucket
格式:
ceph osd crush remove {bucket-name}
4.6 重命名bucket
格式:
ceph osd crush rename-bucket <srcname> <dstname>
5. 创建副本池规则
格式:
ceph osd crush rule create-replicated {name} {root} {failure-domain-type} [{class}]
示例:
ceph osd crush rule create-replicated openstack-hdd-rule openstack host hdd
ceph osd crush rule create-replicated openstack-ssd-rule openstack host ssd
ceph osd crush rule create-replicated k8s-hdd-rule k8s host hdd
ceph osd crush rule create-replicated k8s-ssd-rule k8s host ssd
ceph osd crush rule create-replicated cephfs-hdd-rule cephfs host hdd
ceph osd crush rule create-replicated cephfs-ssd-rule cephfs host ssd
ceph osd crush rule create-replicated rgw-hdd-rule rgw host hdd
ceph osd crush rule create-replicated rgw-ssd-rule rgw host ssd
6. 创建EC池规则
格式:
ceph osd erasure-code-profile ls
ceph osd erasure-code-profile get {profile-name}
ceph osd erasure-code-profile set {profile-name} crush-root=default crush-failure-domain=host crush-device-class=hdd k=2 m=2
ceph osd crush rule create-erasure {name} {profile-name}
ceph osd crush rule rm {rule-name}
7. 创建存储池
格式:
ceph osd pool create {pool-name} [{pg-num} [{pgp-num}]] [replicated] [crush-rule-name] [expected-num-objects]
ceph osd pool create {pool-name} [{pg-num} [{pgp-num}]] erasure [erasure-code-profile] [crush-rule-name] [expected_num_objects] [--autoscale-mode=<on,off,warn>]
示例:
ceph osd pool create openstack-hdd openstack-hdd-rule
ceph osd pool create openstack-ssd openstack-ssd-rule
ceph osd pool create k8s-hdd k8s-hdd-rule
ceph osd pool create k8s-ssd k8s-ssd-rule
ceph osd pool create cephfs-data cephfs-hdd-rule
ceph osd pool create cephfs-metadata cephfs-ssd-rule
ceph osd pool create rgw-data rgw-hdd-rule
ceph osd pool create rgw-index rgw-ssd-rule
8. 初始化存储池
格式:
ceph osd pool application enable {pool-name} {application-name}
示例:
rbd pool init openstack-hdd
rbd pool init openstack-ssd
rbd pool init k8s-hdd
rbd pool init k8s-ssd
ceph osd pool application enable openstack-hdd rbd
ceph osd pool application enable openstack-ssd rbd
ceph osd pool application enable k8s-hdd rbd
ceph osd pool application enable k8s-ssd rbd
标签:MAP,06,crush,bucket,Pacific,ceph,rule,osd,pool From: https://www.cnblogs.com/varden/p/17139658.html