To know what's inside a CRUSH map, we need to extract it and decompile it to convert it into a human-readable form and for easy editing. We can perform all the necessary changes to a CRUSH map at this stage, and to make the changes take effect, we should compile and inject it back to the Ceph cluster. The change to Ceph clusters by the new CRUSH map is dynamic, that is, once the new CRUSH map is injected into the Ceph cluster, the change will come into effect immediately on the fly. We will now take a look at the CRUSH map of our Ceph cluster that we deployed in this book.
Extract the CRUSH map from any of the monitor nodes:
# ceph osd getcrushmap -o crushmap_compiled_file
Once you have the CRUSH map, decompile it to make it human readable and editable:
# crushtool -d crushmap_compiled_file -o crushmap_decompiled_file
At this point, the output file, crushmap_decompiled_file
, can be viewed/edited in your favorite editor.
In the next section, we will learn how to perform changes to a CRUSH map.
Once the changes are done, you should compile the changes with -c
command option:
# crushtool -c crushmap_decompiled_file -o newcrushmap
Finally, inject the new compiled CURSH map into the Ceph cluster with -i
command option:
# ceph osd setcrushmap -i newcrushmap
A CRUSH map file contains four sections; they are as follows:
[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 | straw ] hash [the hash type: 0 by default] item [item-name] weight [weight] }
The following is the bucket definition section from our sandbox Ceph cluster:
rule <rulename> { ruleset <ruleset> type [ replicated | raid4 ] min_size <min-size> max_size <max-size> step take <bucket-type> step [choose|chooseleaf] [firstn|indep] <N> <bucket-type> step emit }
13.58.44.229