「Ceph」- 维护管理:CRUSH map

修改 CRUSH Map 内容(改)

Ceph Documentation/CRUSH Maps

直接修改 CRUSH Map 内容

# 导出当前 CRUSH Map 内容(二进制)
ceph osd getcrushmap -o crushmap_compiled_file

# 导出结果转成文本文件
crushtool -d crushmap_compiled_file -o crushmap_decompiled_file

# 修改文件内容
vim crushmap_decompiled_file

# 生成新的 CRUSH Map 文件
crushtool -c crushmap_decompiled_file -o crushmap_compiled_file.new

# 测试文件内容
crushtool --test -i ./crushmap_compiled_file.new --num-rep 3 --rule 1 --show-mappings

# 应用新的 CRUSH Map 文件
ceph osd setcrushmap -i crushmap_compiled_file.new

# 针对 CRUSH Map 的编辑,是立即生效的。等待变更……
ceph status 

# 重新查看新的集群映射图
ceph osd tree

通过命令修改 CRUSH Map 信息

命令行无法直接修改 CRUSH Map 的内容,但是部分针对 Ceph Cluster 的操作能够反馈到 CRUSH Map 中

# ceph osd crush remove osd.9

# ceph osd crush remove pc-amd64-100249