CRUSH hierarchy
The CRUSH map is a directed acyclic graph, so it can accommodate multiple hierarchies, for example, performance domains.
The easiest way to create and modify a CRUSH hierarchy is with the Ceph CLI; however, you can also decompile a CRUSH map, edit it, recompile it, and activate it.
When declaring a bucket instance with the Ceph CLI, you must specify its type and give it a
unique string name. Ceph automatically assigns a bucket ID, sets the algorithm to
straw2, sets the hash to 0 reflecting rjenkins1
and sets a weight. When modifying a decompiled CRUSH map, assign the bucket a unique ID expressed as
a negative integer (optional), specify a weight relative to the total capacity/capability of its
item(s), specify the bucket algorithm (usually straw2), and the hash (usually
0, reflecting hash algorithm rjenkins1).
A bucket can have one or more items. The items can consist of node buckets (for example, racks, rows, hosts) or leaves (for example, an OSD disk). Items can have a weight that reflects the relative weight of the item.
When modifying a decompiled CRUSH map, you can declare a node bucket with the following syntax:
[bucket-type] [bucket-name] {
id [a unique negative numeric ID]
weight [the relative capacity/capability of the item(s)]
alg [the bucket type: uniform | list | tree | straw2 ]
hash [the hash type: 0 by default]
item [item-name] weight [weight]
}
For example, we would define two host buckets and one rack bucket. The OSDs are declared as items within the host buckets:
host node1 {
id -1
alg straw2
hash 0
item osd.0 weight 1.00
item osd.1 weight 1.00
}
host node2 {
id -2
alg straw2
hash 0
item osd.2 weight 1.00
item osd.3 weight 1.00
}
rack rack1 {
id -3
alg straw2
hash 0
item node1 weight 2.00
item node2 weight 2.00
}