首页 > 代码库 > ceph crushmap

ceph crushmap

实验环境中修改后的crushmap如下:

# begin crush map
tunable choose_local_tries 0
tunable choose_local_fallback_tries 0
tunable choose_total_tries 50
tunable chooseleaf_descend_once 1

# devices
device 0 osd.0
device 1 osd.1
device 2 osd.2
device 3 osd.3
device 4 osd.4
device 5 osd.5

# 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 osd0 {
	id -2		# do not change unnecessarily
	# weight 0.020
	alg straw
	hash 0	# rjenkins1
	item osd.0 weight 0.010
	item osd.1 weight 0.010
}
host osd1 {
	id -3		# do not change unnecessarily
	# weight 0.020
	alg straw
	hash 0	# rjenkins1
	item osd.2 weight 0.010
	item osd.3 weight 0.010
}
host osd2 {
	id -4		# do not change unnecessarily
	# weight 0.020
	alg straw
	hash 0	# rjenkins1
	item osd.4 weight 0.010
	item osd.5 weight 0.010
}

host osd3 {
	id -5
	alg straw
	hash 0
	item osd.0 weight 0.010
	item osd.2 weight 0.010
	item osd.4 weight 0.010
}

root default {
	id -1		# do not change unnecessarily
	# weight 0.060
	alg straw
	hash 0	# rjenkins1
#     	item osd0 weight 0.020
#	item osd1 weight 0.020
#	item osd2 weight 0.020
	item osd3 weight 0.030
}

# rules
rule replicated_ruleset {
	ruleset 0
	type replicated
	min_size 1
	max_size 10
	step take default
	step chooseleaf firstn 0 type osd
	step emit
}
# end crush map

这里我自定义了一个osd3,osd3中包含了其他3台机器中的各一块盘。然后在默认桶中加入osd3,修改rule,需要注意的是,rule中的type要改成osd!

按照以上套路,就可以很方便的定义自己的crushmap了。