Ceph实验室:第八课:查看Ceph CRUSH map

    xiaoxiao2025-11-12  5

    查看CRUSH map

    从monitor节点上获取CRUSH map [root@ceph ceph]# ceph osd getcrushmap -o crushmap_compiled_file

    反编译CRUSH map [root@ceph ceph]# crushtool -d crushmap_compiled_file -o crushmap_decompiled_file

    修改完成后,我们需要编译他 [root@ceph ceph]# crushtool -d crushmap_decompiled_file -o newcrushmap 将新CRUSH map导入集群中 [root@ceph ceph]# ceph osd setcrushmap -i newcrushmap     [root@ceph ceph]# cat crushmap_decompiled_file # 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 straw_calc_version 1 # devices device 0 osd.0 device 1 osd.1 device 2 osd.2 # 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 ceph-node1 { id -2 # do not change unnecessarily # weight 0.000 alg straw hash 0 # rjenkins1 } host ceph { id -3 # do not change unnecessarily # weight 0.044 alg straw hash 0 # rjenkins1 item osd.2 weight 0.015 item osd.1 weight 0.015 item osd.0 weight 0.015 } root default { id -1 # do not change unnecessarily # weight 0.044 alg straw hash 0 # rjenkins1 item ceph-node1 weight 0.000 item ceph weight 0.044 } # rules rule replicated_ruleset { ruleset 0 #rule编号 type replicated #定义pool类型为replicated(还有esurecode模式) min_size 1 #pool中最小指定的副本数量不能小1 max_size 10 #pool中最大指定的副本数量不能大于10 step take default #定义pg查找副本的入口点 step chooseleaf firstn 0 type host  #选叶子节点、深度优先、隔离host step emit #结束 } # end crush map

    注:

    下面解释来自:https://my.oschina.net/u/2460844/blog/531722

    影响 crush 算法结果的有两种因素,一个就是 OSD Map 的结构,另外一个就是 crush rule OSDMap 其实就是一个树形的结构,叶子节点是 device (也就是 osd ),其他的节点称为 bucket 节点,这些 bucket 都是虚构的节点,可以根据物理结构进行抽象,当然树形结构只有一个最终的根节点称之为 root 节点,中间虚拟的 bucket 节点可以是数据中心抽象、机房抽象、机架抽象、主机抽象等。 上图中红色框内的节点都是 bucket 节点,这些节点都是根据实际情况进行抽象得来的。 其实也就是实际中整个物理拓扑结构。这个拓扑里的每个节点都有一个权重值,这个权重值等于所有子节点的权重之和,叶子节点的重量由 osd 的容量决定,一般设定 1T 的权重为 1 对于 bucket 节点不只是虚设的节点, bucket 同样有 type bucket type 有四种类型结构, uniform list tree straw 。这四种 bucket 有着不同的特性, bucket type 设定同样也影响着 crush 算法。 不同 类型 定位数据在哪个子节点的过程不同。 crush rule主要作用: 1 从OSD Map中的哪个节点开始查找 2 使用那个节点作为故障隔离域 3 定位副本的搜索模式(广度优先 or 深度优先)

    最新回复(0)