目录

  • 简介
  • 配置crush class
    • 1. 创建ssd class
    • 2. 创建基于ssd的class rule
    • 3. 创建基于ssd_rule规则的存储池
    • 4. 测试基于ssd的池

简介

ceph从L版本开始新增了个功能叫crush class,又被称之为磁盘智能分组。因为这个功能就是根据磁盘类型自动进行属性关联,然后进行分类减少了很多的人为操作。在这个功能之前,如果我们需要对ssd和hdd进行分组的时候,需要大量的修改crushmap,然后绑定不同的存储池到不同的crush树上面,而这个功能让我们简化了这种逻辑。

ceph中的每个设备都可以选择一个class类型与之关联,通常有三种class类型:

  • hdd
  • ssd
  • nvme

配置crush class

1. 创建ssd class

默认情况下,我们所有的osd都会class类型都是hdd:

root@ceph:~# ceph osd crush class ls
["hdd"
]

查看当前的osd布局:

root@ceph:~# ceph osd tree
ID  CLASS WEIGHT   TYPE NAME                      STATUS REWEIGHT PRI-AFF -1       47.37482 root default                                           -3       11.84311     host ctnr.a1-56-11.pub.unp                         0   hdd  1.81879         osd.0                      up  1.00000 1.00000 25   hdd  1.81879         osd.25                     up  1.00000 1.00000 26   hdd  1.81879         osd.26                     up  1.00000 1.00000 27   hdd  1.81879         osd.27                     up  1.00000 1.00000 28   hdd  1.81879         osd.28                     up  1.00000 1.00000 29   hdd  1.81879         osd.29                     up  1.00000 1.00000 30   hdd  0.46519         osd.30                     up  1.00000 1.00000 31   hdd  0.46519         osd.31                     up  1.00000 1.00000 -2       11.84430     host ctnr.a1-56-14.pub.unp                         1   hdd  1.81898         osd.1                      up  1.00000 1.00000 11   hdd  1.81898         osd.11                     up  1.00000 1.00000 12   hdd  1.81898         osd.12                     up  1.00000 1.00000 13   hdd  1.81898         osd.13                     up  1.00000 1.00000 14   hdd  1.81898         osd.14                     up  1.00000 1.00000 15   hdd  1.81898         osd.15                     up  1.00000 1.00000 16   hdd  0.46519         osd.16                     up  1.00000 1.00000 17   hdd  0.46519         osd.17                     up  1.00000 1.00000 -7       11.84430     host ctnr.a1-56-15.pub.unp                         2   hdd  1.81898         osd.2                      up  1.00000 1.00000 3   hdd  1.81898         osd.3                      up  1.00000 1.00000 5   hdd  1.81898         osd.5                      up  1.00000 1.00000 6   hdd  1.81898         osd.6                      up  1.00000 1.00000 7   hdd  1.81898         osd.7                      up  1.00000 1.00000 8   hdd  1.81898         osd.8                      up  1.00000 1.00000 9   hdd  0.46519         osd.9                      up  1.00000 1.00000 10   hdd  0.46519         osd.10                     up  1.00000 1.00000
-11       11.84311     host ctnr.a1-56-16.pub.unp                         4   hdd  1.81879         osd.4                      up  1.00000 1.00000 18   hdd  1.81879         osd.18                     up  1.00000 1.00000 19   hdd  1.81879         osd.19                     up  1.00000 1.00000 20   hdd  1.81879         osd.20                     up  1.00000 1.00000 21   hdd  1.81879         osd.21                     up  1.00000 1.00000 22   hdd  1.81879         osd.22                     up  1.00000 1.00000 23   hdd  0.46519         osd.23                     up  1.00000 1.00000 24   hdd  0.46519         osd.24                     up  1.00000 1.00000 

可以看到,当前有四个osd节点,每个节点上有8个osd,我们假设说每个节点上的最后两个osd为ssd磁盘。现在需要为其创建ssd的class。我们需要先将所有的ssd的osd从hdd class中删除:

for i in 30 31 16 17 9 10 23 24; do ceph osd crush rm-device-class osd.$i;done

这个时候,如果我们再次使用ceph osd tree查看osd布局,会看到被我们指定的osd前面不再有hdd标识,事实上啥也没有了。

此时可通过如下指令将这些osd添加至ssd class:

for i in 30 31 16 17 9 10 23 24; do ceph osd crush set-device-class ssd osd.$i;done

添加完成之后,我们再次查看osd布局:

root@ceph:~# ceph osd tree
ID  CLASS WEIGHT   TYPE NAME                      STATUS REWEIGHT PRI-AFF -1       47.37482 root default                                           -3       11.84311     host ctnr.a1-56-11.pub.unp                         0   hdd  1.81879         osd.0                      up  1.00000 1.00000 25   hdd  1.81879         osd.25                     up  1.00000 1.00000 26   hdd  1.81879         osd.26                     up  1.00000 1.00000 27   hdd  1.81879         osd.27                     up  1.00000 1.00000 28   hdd  1.81879         osd.28                     up  1.00000 1.00000 29   hdd  1.81879         osd.29                     up  1.00000 1.00000 30   ssd  0.46519         osd.30                     up  1.00000 1.00000 31   ssd  0.46519         osd.31                     up  1.00000 1.00000 -2       11.84430     host ctnr.a1-56-14.pub.unp                         1   hdd  1.81898         osd.1                      up  1.00000 1.00000 11   hdd  1.81898         osd.11                     up  1.00000 1.00000 12   hdd  1.81898         osd.12                     up  1.00000 1.00000 13   hdd  1.81898         osd.13                     up  1.00000 1.00000 14   hdd  1.81898         osd.14                     up  1.00000 1.00000 15   hdd  1.81898         osd.15                     up  1.00000 1.00000 16   ssd  0.46519         osd.16                     up  1.00000 1.00000 17   ssd  0.46519         osd.17                     up  1.00000 1.00000 -7       11.84430     host ctnr.a1-56-15.pub.unp                         2   hdd  1.81898         osd.2                      up  1.00000 1.00000 3   hdd  1.81898         osd.3                      up  1.00000 1.00000 5   hdd  1.81898         osd.5                      up  1.00000 1.00000 6   hdd  1.81898         osd.6                      up  1.00000 1.00000 7   hdd  1.81898         osd.7                      up  1.00000 1.00000 8   hdd  1.81898         osd.8                      up  1.00000 1.00000 9   ssd  0.46519         osd.9                      up  1.00000 1.00000 10   ssd  0.46519         osd.10                     up  1.00000 1.00000
-11       11.84311     host ctnr.a1-56-16.pub.unp                         4   hdd  1.81879         osd.4                      up  1.00000 1.00000 18   hdd  1.81879         osd.18                     up  1.00000 1.00000 19   hdd  1.81879         osd.19                     up  1.00000 1.00000 20   hdd  1.81879         osd.20                     up  1.00000 1.00000 21   hdd  1.81879         osd.21                     up  1.00000 1.00000 22   hdd  1.81879         osd.22                     up  1.00000 1.00000 23   ssd  0.46519         osd.23                     up  1.00000 1.00000 24   ssd  0.46519         osd.24                     up  1.00000 1.00000

可以看到我们选定的osd的class都变为了ssd。

然后我们再次查看crush class,也多出了一个名为ssd的class:

root@ceph:~# ceph osd crush class ls
["hdd","ssd"
]

2. 创建基于ssd的class rule

创建一个class rule,取名为ssd_rule,使用ssd的osd:

ceph osd crush rule create-replicated ssd_rule default host ssd

查看集群rule:

root@ceph:~# ceph osd crush rule ls
replicated_rule
ssd_rule

通过如下方式查看详细的crushmap信息:

root@ceph:~# ceph osd getcrushmap -o crushmap
172
root@ceph:~# crushtool -d crushmap -o crushmap.txt
root@ceph:~# cat 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 chooseleaf_vary_r 1
tunable straw_calc_version 1
tunable allowed_bucket_algs 54# devices
device 0 osd.0 class hdd
device 1 osd.1 class hdd
device 2 osd.2 class hdd
device 3 osd.3 class hdd
device 4 osd.4 class hdd
device 5 osd.5 class hdd
device 6 osd.6 class hdd
device 7 osd.7 class hdd
device 8 osd.8 class hdd
device 9 osd.9 class ssd
device 10 osd.10 class ssd
device 11 osd.11 class hdd
device 12 osd.12 class hdd
device 13 osd.13 class hdd
device 14 osd.14 class hdd
device 15 osd.15 class hdd
device 16 osd.16 class ssd
device 17 osd.17 class ssd
device 18 osd.18 class hdd
device 19 osd.19 class hdd
device 20 osd.20 class hdd
device 21 osd.21 class hdd
device 22 osd.22 class hdd
device 23 osd.23 class ssd
device 24 osd.24 class ssd
device 25 osd.25 class hdd
device 26 osd.26 class hdd
device 27 osd.27 class hdd
device 28 osd.28 class hdd
device 29 osd.29 class hdd
device 30 osd.30 class ssd
device 31 osd.31 class ssd# 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 ctnr.a1-56-11.pub.unp {id -3           # do not change unnecessarilyid -4 class hdd         # do not change unnecessarilyid -9 class ssd         # do not change unnecessarily# weight 11.843alg straw2hash 0  # rjenkins1item osd.0 weight 1.819item osd.25 weight 1.819item osd.26 weight 1.819item osd.27 weight 1.819item osd.28 weight 1.819item osd.29 weight 1.819item osd.30 weight 0.465item osd.31 weight 0.465
}
host ctnr.a1-56-15.pub.unp {id -7           # do not change unnecessarilyid -8 class hdd         # do not change unnecessarilyid -10 class ssd                # do not change unnecessarily# weight 11.844alg straw2hash 0  # rjenkins1item osd.2 weight 1.819item osd.3 weight 1.819item osd.5 weight 1.819item osd.6 weight 1.819item osd.7 weight 1.819item osd.8 weight 1.819item osd.9 weight 0.465item osd.10 weight 0.465
}
host ctnr.a1-56-14.pub.unp {id -2           # do not change unnecessarilyid -5 class hdd         # do not change unnecessarilyid -13 class ssd                # do not change unnecessarily# weight 11.844alg straw2hash 0  # rjenkins1item osd.1 weight 1.819item osd.11 weight 1.819item osd.12 weight 1.819item osd.13 weight 1.819item osd.14 weight 1.819item osd.15 weight 1.819item osd.16 weight 0.465item osd.17 weight 0.465
}
host ctnr.a1-56-16.pub.unp {id -11          # do not change unnecessarilyid -12 class hdd                # do not change unnecessarilyid -14 class ssd                # do not change unnecessarily# weight 11.843alg straw2hash 0  # rjenkins1item osd.4 weight 1.819item osd.18 weight 1.819item osd.19 weight 1.819item osd.20 weight 1.819item osd.21 weight 1.819item osd.22 weight 1.819item osd.23 weight 0.465item osd.24 weight 0.465
}
root default {id -1           # do not change unnecessarilyid -6 class hdd         # do not change unnecessarilyid -15 class ssd                # do not change unnecessarily# weight 47.375alg straw2hash 0  # rjenkins1item ctnr.a1-56-11.pub.unp weight 11.843item ctnr.a1-56-15.pub.unp weight 11.844item ctnr.a1-56-14.pub.unp weight 11.844item ctnr.a1-56-16.pub.unp weight 11.843
}# rules
rule replicated_rule {id 0type replicatedmin_size 1max_size 10step take defaultstep chooseleaf firstn 0 type hoststep emit
}
rule ssd_rule {id 1type replicatedmin_size 1max_size 10step take default class ssdstep chooseleaf firstn 0 type hoststep emit
}# end crush map

3. 创建基于ssd_rule规则的存储池

  1. 创建一个基于该ssdh_rule规则的存储池:
ceph osd pool create cache 64 64 ssd_rule# 查看cache的信息可以看到使用的crush_rule为1,也就是ssd_rule
root@ceph:~# ceph osd pool get cache crush_rule
crush_rule: ssd_rule
  1. 将一个现有的池迁移至ssd的osd上:
ceph osd pool set cephfs_metadata crush_rule ssd_ruleroot@ceph:~# ceph osd pool get cephfs_metadata crush_rule
crush_rule: ssd_rule

4. 测试基于ssd的池

root@ceph:~# echo "hello world" > test.txt
root@ceph:~# rados -p cache put test test.txt
root@ceph:~# rados -p cache get test
root@ceph:~# rados -p cache ls |grep test
test
root@ceph:~# ceph osd map cache test
osdmap e3156 pool 'cache' (4) object 'test' -> pg 4.40e8aab5 (4.35) -> up ([23,30,16], p23) acting ([23,30,16], p23)

参考: https://blog.csdn.net/kozazyh/article/details/79904219

转载于:https://www.cnblogs.com/breezey/p/11080529.html

crushmap磁盘智能分组相关推荐

  1. Regal灰度发布智能分组引擎

    Regal 是一个用于"灰度发布"或 A/B Testing的智能分组引擎 主要功能: 提供发布策略,动态智能分流 支持多版本分组和优先级 数据格式化 同时兼容Python2和Py ...

  2. 网易易盾升级内容安全体系 发布智能审核管理系统

    内容安全已成为全球性互联网生态治理难题.互联网平台多媒体内容爆发带来海量信息的同时,也泥沙俱下裹挟有大量不良有害信息. 当内容平台发展快速,就会被灰黑产盯上,视作"流量蜜罐",利用 ...

  3. 磁盘类型和相关术语学习笔记

    磁盘类型和相关术语 在 Linux 中一切皆文件,但是类型不同.例如使用 ls -l 对于设备文件和普通文件有一部分内容是不同的,即普通文件有大小,而设备文件有主设备号和次设备号,没有大小. # ll ...

  4. 大数据周周看:前英特尔高管加入谷歌云部门,网易与威马汽车合作打造“互联网+”时代智能汽车

    前英特尔数据中心主管加入谷歌云部门,出任COO一职:医疗科技公司"图玛深维"获2亿元B轮融资:网易人工智能与威马汽车合作,打造"互联网+"时代智能汽车--以下为 ...

  5. 科华发布明星产品:S³锂电智能后备解决方案

    在"S³,Li来重构--科华S³智能后备锂电系统发布会"上,科华数据发布了第三代锂电系统解决方案.安全.智能.极简三重加持的科华S³锂电受到业内媒体及专业用户的广泛认可. 在发布会 ...

  6. ceph---ceph osd DNE状态对集群的影响

    删除一块磁盘,由于没有从crushmap中删除,导致一块磁盘的状态变为DNE(does not exist).DNE对集群有影响.例如集群删除过一些状态错误的pg,重启整个集群,重新创建pg,这些pg ...

  7. 深信服超融合技术架构(重点介绍主要模块)

    目录 超融合架构定义 系统总体架构 1.aSV 计算机虚拟化平台 1.1 概述 1.2 aSV 技术原理 1.2.1 Hypervisor 分类 (1)裸金属型 (2)宿主型 (3) aSV 的 Hy ...

  8. 曾经无话不谈的好朋友,如今怎么见个面都难

    大飞和方平是两家中小企业的IT总监,老乡会上认识之后,两人很快成了朋友,经常在工作之余一起打打球.爬爬山.喝喝酒.看看电影(同漫威"死忠粉"),几乎无话不谈. 一个周五,像往常一样 ...

  9. xcode快捷键大全

    调整图片大小的时候按下:option键 让让控件跟内容一样大:command+= http://www.cr173.com/html/21801_1.html 一.关于运行调试 1.运行,停止,都在工 ...

最新文章

  1. 智能车竞赛技术报告 | 双车接力组 - 大连海事大学 - 同舟拾贰队
  2. poj 2247 Humble Numbers
  3. 计算机里的文件弄不到桌面怎么办,笔记本电脑桌面上的文件夹不见了怎么办
  4. logstash5.x改变
  5. xbmc addons
  6. php注册树模式,PHP设计模式之详记注册树模式
  7. 在python中创建虚拟环境和Django对数据库的操作(一)
  8. SharpHsql -- 只适合用于演示数据的数据库引擎
  9. CAD图纸上面缺失的线条如何将其进行补充?
  10. 考上了乡镇的公务员,又不想去了,很纠结,怎么办?
  11. 电梯轿厢预留人脸识别接口和指纹接口_奥的斯电梯 gt;LSFAULT ! 故障现象捕捉
  12. lisp绘制直齿圆柱齿轮_直齿圆柱齿轮的画法
  13. Android高仿今日头条/QQ空间手势下拉关闭图片效果
  14. 3D人脸重建(二) 数据
  15. QT创建一个excel文件(通过save as 方法)
  16. python2.7安装mysqldb_python2.7安装MySQLdb库
  17. unigine 三维旋转矩阵(mat3,quat) scale translate 变换矩阵(mat4) 和forward up right 关系 normal binormal tangent
  18. 目前流行的装修风格_现在最流行的装修风格是什么 装修风格流行趋势是什么...
  19. Zend Studio 9.0.3正式版注册破解
  20. 「Python数据分析系列」10.使用数据

热门文章

  1. AI+视频分析:实时监测无处不在的安全风险
  2. 科普天地|“GPS欺骗”如何误导自动驾驶汽车
  3. 沈南鹏谈科学:第一性原理,“无为”而“有趣”
  4. 存内计算能否成为下一代AI芯片的关键
  5. 2019年云计算行业深度报告
  6. 从车联网到工业智联网
  7. 《麻省理工科技评论》:2018年18大科技趋势,2017年7大失败技术
  8. 同为 Java 开发:有了这些 Java 项目经历,面大厂稳了!
  9. 学到了!程序员大神用这招让开发效率直接提升 10 倍!!
  10. 开源代码却无奈遗弃,濒临奔溃的开源开发者们!