xiaowei8782088 发表于 2019-2-2 07:03:03

Ceph 定制crush map

定制化crush map简单实验
  首先,查看原始osd目录树
  # ceph osd tree
  # id    weighttype name       up/down reweight
  -1      3.24    root default
  -5      1.08            rack rack1
  -2      1.08                  host bgw-os-node151
  0       0.27                            osd.0   up      1
  1       0.27                            osd.1   up      1
  2       0.27                            osd.2   up      1
  3       0.27                            osd.3   up      1
  -6      1.08            rack rack2
  -3      1.08                  host bgw-os-node152
  4       0.27                            osd.4   up      1
  5       0.27                            osd.5   up      1
  6       0.27                            osd.6   up      1
  7       0.27                            osd.7   up      1
  -7      1.08            rack rack3
  -4      1.08                  host bgw-os-node153
  8       0.27                            osd.8   up      1
  9       0.27                            osd.9   up      1
  10      0.27                            osd.10up      1
  11      0.27                            osd.11up      1
  导出现有的crush map信息
  # ceph osd getcrushmap -o crushmap.obj
  got crush map from osdmap epoch 98
  对导出的map文件进行反编译
  # crushtool -d crushmap.obj -o decrushmap.obj
  修改map信息
  # vim decrushmap.obj    #修改对象的权重,注意需要反编译后才能查看
  
  # 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
  device 6 osd.6
  device 7 osd.7
  device 8 osd.8
  device 9 osd.9
  device 10 osd.10
  device 11 osd.11
  

  # 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 bgw-os-node151 {
  id -2         # do not change unnecessarily
  # weight 1.080
  alg straw
  hash 0# rjenkins1
  item osd.0 weight 0.270
  item osd.1 weight 0.270
  item osd.2 weight 0.270
  item osd.3 weight 0.270
  }
  rack rack1 {
  id -5         # do not change unnecessarily
  # weight 1.080
  alg straw
  hash 0# rjenkins1
  item bgw-os-node151 weight 1.080
  }
  host bgw-os-node152 {
  id -3         # do not change unnecessarily
  # weight 1.080
  alg straw
  hash 0# rjenkins1
  item osd.4 weight 0.540
        item osd.5 weight 0.540
        item osd.6 weight 0.540
        item osd.7 weight 0.540
  }
  rack rack2 {
  id -6         # do not change unnecessarily
  # weight 1.080
  alg straw
  hash 0# rjenkins1
  item bgw-os-node152 weight 1.080
  }
  host bgw-os-node153 {
  id -4         # do not change unnecessarily
  # weight 1.080
  alg straw
  hash 0# rjenkins1
   item osd.8 weight 0.360
        item osd.9 weight 0.360
        item osd.10 weight 0.360
        item osd.11 weight 0.360
  }
  rack rack3 {
  id -7         # do not change unnecessarily
  # weight 1.080
  alg straw
  hash 0# rjenkins1
  item bgw-os-node153 weight 1.080
  }
  root default {
  id -1         # do not change unnecessarily
  # weight 3.240
  alg straw
  hash 0# rjenkins1
  item rack1 weight 1.080
  item rack2 weight 1.080
  item rack3 weight 1.080
  }
  

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

  对修改后的map信息进行编译
  # crushtool -c decrushmap.obj -o crushnew.obj
  根据新map信息重新设置crush map
  # ceph osd setcrushmap -i crushnew.obj
  查看新的osd目录树
  
  # ceph osd tree         #结果
  # id    weighttype name       up/down reweight
  -1      3.24    root default
  -5      1.08            rack rack1
  -2      1.08                  host bgw-os-node151
  0       0.27                            osd.0   up      1
  1       0.27                            osd.1   up      1
  2       0.27                            osd.2   up      1
  3       0.27                            osd.3   up      1
  -6      1.08            rack rack2
  -3      1.08                  host bgw-os-node152
  4       0.54                            osd.4   up      1
  5       0.54                            osd.5   up      1
  6       0.54                            osd.6   up      1
  7       0.54                            osd.7   up      1
  -7      1.08            rack rack3
  -4      1.08                  host bgw-os-node153
  8       0.36                            osd.8   up      1
  9       0.36                            osd.9   up      1
  10      0.36                            osd.10up      1
  11      0.36                            osd.11up      1
  上面可修该的内容还有很多,可根据具体的要求进行相应的修改。
  参考:http://ceph.com/docs/master/rados/operations/crush-map/#crush-map-bucket-types



页: [1]
查看完整版本: Ceph 定制crush map