1. 获取crushmap二进制文件
# ceph osd getcrushmap -o a.map
2.将二进制文件转成文本文件
# crushtool -d a.map -o b
3.修改rules
# vi b
# begin crush map
tunable choose_local_tries 0
tunable choose_local_fallback_tries 0
tunable choose_total_tries 50
tunable chooseleaf_descend_once 1
tunable chooseleaf_vary_r 1
tunable chooseleaf_stable 1
tunable straw_calc_version 1
tunable allowed_bucket_algs 54
# devices
device 0 osd.0 class hdd
device 1 osd.1 class hdd
device 2 osd.2 class hdd
device 3 osd.3 class hdd
device 4 osd.4 class hdd
device 5 osd.5 class hdd
device 6 osd.6 class hdd
device 7 osd.7 class hdd
device 8 osd.8 class hdd
device 9 osd.9 class hdd
device 10 osd.10 class hdd
device 11 osd.11 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 region
type 10 root
# buckets
host ceph01-sas {
id -3 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.0 weight 0.010
item osd.1 weight 0.010
}
host ceph01-ssd {
id -4 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.6 weight 0.010
item osd.7 weight 0.010
}
host ceph02-sas {
id -5 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.2 weight 0.010
item osd.3 weight 0.010
}
host ceph02-ssd {
id -6 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.8 weight 0.010
item osd.9 weight 0.010
}
host ceph03-sas {
id -7 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.4 weight 0.010
item osd.5 weight 0.010
}
host ceph03-ssd {
id -8 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.10 weight 0.010
item osd.11 weight 0.010
}
root default {
id -1 # do not change unnecessarily
# weight 0.117
alg straw2
hash 0 # rjenkins1
item ceph01-sas weight 0.039
item ceph02-sas weight 0.039
item ceph03-sas weight 0.039
item ceph01-ssd weight 0.039
item ceph02-ssd weight 0.039
item ceph03-ssd weight 0.039
}
root ssd {
id -9 # do not change unnecessarily
alg straw
hash 0 # rjenkins1
item ceph01-ssd
item ceph02-ssd
item ceph03-ssd
}
root sas {
id -10 # do not change unnecessarily
alg straw
hash 0 # rjenkins1
item ceph01-sas
item ceph02-sas
item ceph03-sas
}
# 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
}
rule ssd {
id 3
type replicated
min_size 1
max_size 10
step take ssd
step choose firstn 0 type host
step emit
}
rule sas {
id 4
type replicated
min_size 1
max_size 10
step take sas
step choose firstn 0 type host
step emit
}
# end crush map
4.将文本文件转成二进制文件
# crushtool -c b -o b.map
5.设置crushmap
# ceph osd setcrushmap -i b.map
[lam@ceph01 ceph-cluster]$ ceph osd pool create sas 200
pool 'sas' created
[lam@ceph01 ceph-cluster]$ ceph osd pool create ssd 200
pool 'ssd' created
ceph osd pool set ssd crush_rule ssd
ceph osd pool set sas crush_rule sas
ceph osd dump | grep replica
ceph osd tier add sas ssd
重启所有节点
systemctl restart ceph.target
# ceph osd getcrushmap -o a.map
2.将二进制文件转成文本文件
# crushtool -d a.map -o b
3.修改rules
# vi b
# begin crush map
tunable choose_local_tries 0
tunable choose_local_fallback_tries 0
tunable choose_total_tries 50
tunable chooseleaf_descend_once 1
tunable chooseleaf_vary_r 1
tunable chooseleaf_stable 1
tunable straw_calc_version 1
tunable allowed_bucket_algs 54
# devices
device 0 osd.0 class hdd
device 1 osd.1 class hdd
device 2 osd.2 class hdd
device 3 osd.3 class hdd
device 4 osd.4 class hdd
device 5 osd.5 class hdd
device 6 osd.6 class hdd
device 7 osd.7 class hdd
device 8 osd.8 class hdd
device 9 osd.9 class hdd
device 10 osd.10 class hdd
device 11 osd.11 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 region
type 10 root
# buckets
host ceph01-sas {
id -3 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.0 weight 0.010
item osd.1 weight 0.010
}
host ceph01-ssd {
id -4 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.6 weight 0.010
item osd.7 weight 0.010
}
host ceph02-sas {
id -5 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.2 weight 0.010
item osd.3 weight 0.010
}
host ceph02-ssd {
id -6 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.8 weight 0.010
item osd.9 weight 0.010
}
host ceph03-sas {
id -7 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.4 weight 0.010
item osd.5 weight 0.010
}
host ceph03-ssd {
id -8 # do not change unnecessarily
alg straw2
hash 0 # rjenkins1
item osd.10 weight 0.010
item osd.11 weight 0.010
}
root default {
id -1 # do not change unnecessarily
# weight 0.117
alg straw2
hash 0 # rjenkins1
item ceph01-sas weight 0.039
item ceph02-sas weight 0.039
item ceph03-sas weight 0.039
item ceph01-ssd weight 0.039
item ceph02-ssd weight 0.039
item ceph03-ssd weight 0.039
}
root ssd {
id -9 # do not change unnecessarily
alg straw
hash 0 # rjenkins1
item ceph01-ssd
item ceph02-ssd
item ceph03-ssd
}
root sas {
id -10 # do not change unnecessarily
alg straw
hash 0 # rjenkins1
item ceph01-sas
item ceph02-sas
item ceph03-sas
}
# 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
}
rule ssd {
id 3
type replicated
min_size 1
max_size 10
step take ssd
step choose firstn 0 type host
step emit
}
rule sas {
id 4
type replicated
min_size 1
max_size 10
step take sas
step choose firstn 0 type host
step emit
}
# end crush map
4.将文本文件转成二进制文件
# crushtool -c b -o b.map
5.设置crushmap
# ceph osd setcrushmap -i b.map
[lam@ceph01 ceph-cluster]$ ceph osd pool create sas 200
pool 'sas' created
[lam@ceph01 ceph-cluster]$ ceph osd pool create ssd 200
pool 'ssd' created
ceph osd pool set ssd crush_rule ssd
ceph osd pool set sas crush_rule sas
ceph osd dump | grep replica
ceph osd tier add sas ssd
重启所有节点
systemctl restart ceph.target