# devices device 0 osd.0 class hdd device 1 osd.1 class hdd device 2 osd.2 class hdd
# types type 0 osd type 1 host type 2 chassis type 3 rack type 4 row type 5 pdu type 6 pod type 7 room type 8 datacenter type 9 zone type 10 region type 11 root
# buckets host ceph-01 { id -3 # do not change unnecessarily id -4 class hdd # do not change unnecessarily # weight 0.029 alg straw2 hash 0 # rjenkins1 item osd.0 weight 0.010 item osd.1 weight 0.010 item osd.2 weight 0.010 } root default { id -1 # do not change unnecessarily id -2 class hdd # do not change unnecessarily # weight 0.029 alg straw2 hash 0 # rjenkins1 item ceph-01 weight 0.029 }
# rules rule replicated_rule { id 0 type replicated min_size 1 max_size 10 step take default step chooseleaf firstn 0 type host step emit }
可以看到其中有一条规则, “step chooseleaf firstn 0 type host”,
将 host 修改为 osd
修改为 step chooseleaf firstn 0 type osd
编译
1
crushtool -c crushmap.txt -o crushmap-new
加载新规则
1
ceph osd setcrushmap -i crushmap-new
再查看集群状态,可以看到 pgs 已经成为 active
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cluster: id: 6c0d548f-5da2-46a5-b289-f1cd16a31aa2 health: HEALTH_WARN 1 pool(s) have non-power-of-two pg_num
services: mon: 1 daemons, quorum ceph-01 (age 52m) mgr: ceph-01(active, since 45m) osd: 3 osds: 3 up (since 50m), 3 in (since 50m)