当前位置: 首页 > news >正文

获取Ceph的CRUSH Map和CRUSH Map介绍

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

 

当你创建一个配置文件并用 mkcephfs部署Ceph, Ceph会在你的配置中生成一个默认CRUSH映射。默认CRUSH映射对你的Ceph sandbox环境很好。然而,当你部署一个大规模的数据集群,你应该着重考虑开发一个自定义CRUSH映射,因为它会帮助你管理你的Ceph集群,提高性能并确保数据的安全性。

例如,如果一个OSD坏了,crush映射可以帮助你可以在你需要使用现场支持或替换硬件的项目中找到失败的OSD的物理数据中心,空间,行和主机的机架。.

同样,crush可以帮助你更迅速地找出故障。例如,如果在一个特定的机架中的所有的OSD同时坏了,故障可能在于一个网络交换机或在机架或网络交换机的电源,而不是OSD本身。

一个自定义的CRUSH映射也可以帮助你识别Ceph存储数据的冗余副本的物理位置。当失败的主机关联配置组都处于降级状态。

1. 获取CRUSH map的二进制文件

ceph osd getcrushmap-o {compiled-crushmap-filename}

# ceph osd getcrushmap -o crushmap.map

 

2.反编译,将二进制文件转成文本文件

crushtool -d {compiled-crushmap-filename} -o {decompiled-crushmap-filename}

# crushtool -d crushmap.map -o  crushmap.txt

 

3.查看crush map

# vim crushmap.txt

# 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 straw_calc_version 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
# 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 node2 {         id -2           # do not change unnecessarily         # weight 0.046         alg straw         hash 0  # rjenkins1         item osd.0 weight 0.018         item osd.5 weight 0.018         item osd.6 weight 0.009
}
host node3 {         id -3           # do not change unnecessarily         # weight 0.046         alg straw         hash 0  # rjenkins1         item osd.1 weight 0.018         item osd.7 weight 0.018         item osd.8 weight 0.009
}
host node1 {         id -4           # do not change unnecessarily        # weight 0.046         alg straw         hash 0  # rjenkins1         item osd.2 weight 0.018         item osd.3 weight 0.018         item osd.4 weight 0.009
}
root default {         id -1           # do not change unnecessarily         # weight 0.137         alg straw         hash 0  # rjenkins1         item node2 weight 0.046         item node3 weight 0.046         item node1 weight 0.046
}
# rules
rule replicated_ruleset {         ruleset 0         type replicated         min_size 1         max_size 10         step take default         step chooseleaf firstn 0 type host         step emit
}
# end crush map

也可以用以下的命令查看crush tree

#  ceph osd crush tree

[     {         "id": -1,         "name": "default",         "type": "root",         "type_id": 10,         "items": [             {                 "id": -2,                 "name": "node2",                 "type": "host",                 "type_id": 1,                 "items": [                     {                         "id": 0,                         "name": "osd.0",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.018494,                         "depth": 2                     },                     {                         "id": 5,                         "name": "osd.5",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.018494,                         "depth": 2                     },                     {                         "id": 6,                         "name": "osd.6",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.008789,                         "depth": 2                     }                 ]             },             {                 "id": -3,                 "name": "node3",                 "type": "host",                 "type_id": 1,                 "items": [                     {                         "id": 1,                         "name": "osd.1",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.018494,                         "depth": 2                     },                     {                         "id": 7,                         "name": "osd.7",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.018494,                         "depth": 2                     },                     {                         "id": 8,                         "name": "osd.8",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.008789,                         "depth": 2                     }                 ]             },             {                 "id": -4,                 "name": "node1",                 "type": "host",                 "type_id": 1,                 "items": [                     {                         "id": 2,                         "name": "osd.2",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.018494,                         "depth": 2                     },                     {                         "id": 3,                         "name": "osd.3",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.018494,                         "depth": 2                     },                     {                         "id": 4,                         "name": "osd.4",                         "type": "osd",                         "type_id": 0,                         "crush_weight": 0.008789,                         "depth": 2                     }                 ]             }         ]     }
]

以及用一下命令查看devices、buckets和rulesets信息。

ceph osd crush dump

ceph osd crush dump
{     "devices": [         {             "id": 0,             "name": "osd.0"         },         {             "id": 1,             "name": "osd.1"         },         {             "id": 2,             "name": "osd.2"         },         {             "id": 3,             "name": "osd.3"         },         {             "id": 4,             "name": "osd.4"         },         {             "id": 5,             "name": "osd.5"         },         {             "id": 6,             "name": "osd.6"         },         {             "id": 7,             "name": "osd.7"         },         {             "id": 8,             "name": "osd.8"         }     ],     "types": [         {             "type_id": 0,             "name": "osd"         },         {             "type_id": 1,             "name": "host"         },         {             "type_id": 2,             "name": "chassis"         },         {             "type_id": 3,             "name": "rack"         },         {             "type_id": 4,             "name": "row"         },         {             "type_id": 5,             "name": "pdu"         },         {             "type_id": 6,             "name": "pod"         },         {             "type_id": 7,             "name": "room"         },         {             "type_id": 8,             "name": "datacenter"         },         {             "type_id": 9,             "name": "region"         },         {             "type_id": 10,             "name": "root"         }     ],     "buckets": [         {             "id": -1,             "name": "default",             "type_id": 10,             "type_name": "root",             "weight": 9000,             "alg": "straw",             "hash": "rjenkins1",             "items": [                 {                     "id": -2,                     "weight": 3000,                     "pos": 0                 },                 {                     "id": -3,                     "weight": 3000,                     "pos": 1                 },                 {                     "id": -4,                     "weight": 3000,                     "pos": 2                 }             ]         },         {             "id": -2,             "name": "node2",             "type_id": 1,             "type_name": "host",             "weight": 3000,             "alg": "straw",             "hash": "rjenkins1",             "items": [                 {                     "id": 0,                     "weight": 1212,                     "pos": 0                 },                 {                     "id": 5,                     "weight": 1212,                     "pos": 1                 },                 {                     "id": 6,                     "weight": 576,                     "pos": 2                 }             ]         },         {             "id": -3,             "name": "node3",             "type_id": 1,             "type_name": "host",             "weight": 3000,             "alg": "straw",             "hash": "rjenkins1",             "items": [                 {                     "id": 1,                     "weight": 1212,                     "pos": 0                 },                 {                     "id": 7,                     "weight": 1212,                     "pos": 1                 },                 {                     "id": 8,                     "weight": 576,                     "pos": 2                 }             ]         },         {             "id": -4,             "name": "node1",             "type_id": 1,             "type_name": "host",             "weight": 3000,             "alg": "straw",             "hash": "rjenkins1",             "items": [                 {                     "id": 2,                     "weight": 1212,                     "pos": 0                 },                 {                     "id": 3,                     "weight": 1212,                     "pos": 1                 },                 {                     "id": 4,                     "weight": 576,                     "pos": 2                 }             ]         }     ],     "rules": [         {             "rule_id": 0,             "rule_name": "replicated_ruleset",             "ruleset": 0,             "type": 1,             "min_size": 1,             "max_size": 10,             "steps": [                 {                     "op": "take",                     "item": -1,                     "item_name": "default"                 },                 {                     "op": "chooseleaf_firstn",                     "num": 0,                     "type": "host"                 },                 {                     "op": "emit"                 }             ]         }     ],     "tunables": {         "choose_local_tries": 0,         "choose_local_fallback_tries": 0,         "choose_total_tries": 50,         "chooseleaf_descend_once": 1,         "chooseleaf_vary_r": 0,         "straw_calc_version": 1,         "allowed_bucket_algs": 22,         "profile": "unknown",         "optimal_tunables": 0,         "legacy_tunables": 0,         "require_feature_tunables": 1,         "require_feature_tunables2": 1,         "require_feature_tunables3": 0,         "has_v2_rules": 0,         "has_v3_rules": 0,         "has_v4_buckets": 0     }
}

 

CRUSH Map介绍

关于详细的CRUSH Maps介绍可以查阅官方文档 CRUSH Maps中查看在ceph中CRUSH Map的介绍和规则,以及查阅算法CRUSH - Controlled, Scalable, Decentralized Placement of Replicated Data。

TODO

 

 

参考文献

[1]  CRUSH映射

[2] CRUSH Maps

[3] CRUSH算法 CRUSH - Controlled, Scalable, Decentralized Placement of Replicated Data

转载于:https://my.oschina.net/u/658505/blog/649732

相关文章:

  • 微信支付v3开发(5) 扫码并输入金额支付
  • 教你如何获取索爱X10 Android2.1 Root权限
  • Perl语言——简单说明
  • Linux命令(4):cat命令
  • javascript 闭包理解例子
  • 客户端putty, xshell连接linux中vim的小键盘问题
  • 2016蘑菇街编程题5题
  • C指针(二)
  • 用Python开发自动化测试脚本
  • git简单命令
  • 程序员健康Tips
  • 如何从mysql备份中提取单张表数据
  • AVAudioSessionCategory说明
  • 一个Android项目多线程下载模块开源库:AndroidFileDownloader
  • Azkaban的Web Server源码探究系列12: 首页之前的跳转
  • 「译」Node.js Streams 基础
  • 78. Subsets
  • android图片蒙层
  • angular学习第一篇-----环境搭建
  • Flex布局到底解决了什么问题
  • iOS动画编程-View动画[ 1 ] 基础View动画
  • javascript面向对象之创建对象
  • js如何打印object对象
  • k8s 面向应用开发者的基础命令
  • MySQL几个简单SQL的优化
  • spring cloud gateway 源码解析(4)跨域问题处理
  • Work@Alibaba 阿里巴巴的企业应用构建之路
  • 规范化安全开发 KOA 手脚架
  • 检测对象或数组
  • 前言-如何学习区块链
  • 我这样减少了26.5M Java内存!
  • 再次简单明了总结flex布局,一看就懂...
  • 这几个编码小技巧将令你 PHP 代码更加简洁
  • 教程:使用iPhone相机和openCV来完成3D重建(第一部分) ...
  • ​【已解决】npm install​卡主不动的情况
  • (16)Reactor的测试——响应式Spring的道法术器
  • (17)Hive ——MR任务的map与reduce个数由什么决定?
  • (附源码)计算机毕业设计ssm基于Internet快递柜管理系统
  • (附源码)计算机毕业设计SSM智能化管理的仓库管理
  • .net core Swagger 过滤部分Api
  • .NET Core引入性能分析引导优化
  • .net 托管代码与非托管代码
  • .NET成年了,然后呢?
  • .NET命名规范和开发约定
  • :中兴通讯为何成功
  • @property python知乎_Python3基础之:property
  • [acwing周赛复盘] 第 69 场周赛20220917
  • [bzoj1912]异象石(set)
  • [C#]winform部署yolov5-onnx模型
  • [C++数据结构](31)哈夫曼树,哈夫曼编码与解码
  • [CISCN2019 华东北赛区]Web2
  • [DNS网络] 网页无法打开、显示不全、加载卡顿缓慢 | 解决方案
  • [FFmpeg学习]从视频中获取图片
  • [Hive] 常见函数
  • [HTTP]HTTP协议的状态码