ceph 指定OSD创建pool
https://my.oschina.net/wangzilong/blog/1549690
ceph集群中允许使用混合类型的磁盘,比如一部分磁盘是SSD,一部分是STAT。如果针对某些业务小高速磁盘SSD,某些业务需要STAT,在创建资源池的时候可以指定创建在某些OSD上。
基本步骤有8步:
当前只有STAT没有SSD,但是不影响实验结果。

1 获取crush map
[root@ceph-admin getcrushmap]# ceph osd getcrushmap -o /opt/getcrushmap/crushmap
got crush map from osdmap epoch 2482
2 反编译crush map
[root@ceph-admin getcrushmap]# crushtool -d crushmap -o decrushmap
3 修改crush map
在root default 后面添加下面两个bucket
root ssd {
id -5
alg straw
hash 0
item osd.0 weight 0.01
}
root stat {
id -6
alg straw
hash 0
item osd.1 weight 0.01
}
在rules部分添加如下规则:
rule ssd{
ruleset 1
type replicated
min_size 1
max_size 10
step take ssd
step chooseleaf firstn 0 type osd
step emit
}
rule stat{
ruleset 2
type replicated
min_size 1
max_size 10
step take stat
step chooseleaf firstn 0 type osd
step emit
}
4 编译crush map
[root@ceph-admin getcrushmap]# crushtool -c decrushmap -o newcrushmap
5 注入crush map
[root@ceph-admin getcrushmap]# ceph osd setcrushmap -i /opt/getcrushmap/newcrushmap
set crush map
[root@ceph-admin getcrushmap]# ceph osd tree
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-6 0.00999 root stat
1 0.00999 osd.1 up 1.00000 1.00000
-5 0.00999 root ssd
0 0.00999 osd.0 up 1.00000 1.00000
-1 0.58498 root default
-2 0.19499 host ceph-admin
2 0.19499 osd.2 up 1.00000 1.00000
-3 0.19499 host ceph-node1
0 0.19499 osd.0 up 1.00000 1.00000
-4 0.19499 host ceph-node2
1 0.19499 osd.1 up 1.00000 1.00000
# 重新查看osd tree 的时候已经看见这个树已经变了。添加了名称为stat和SSD的两个bucket
6 创建资源池
[root@ceph-admin getcrushmap]# ceph osd pool create ssd_pool 8 8
pool 'ssd_pool' created
[root@ceph-admin getcrushmap]# ceph osd pool create stat_pool 8 8
pool 'stat_pool' created
[root@ceph-admin getcrushmap]# ceph osd dump|grep ssd
pool 28 'ssd_pool' replicated size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 8 pgp_num 8 last_change 2484 flags hashpspool stripe_width 0
[root@ceph-admin getcrushmap]# ceph osd dump|grep stat
pool 29 'stat_pool' replicated size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 8 pgp_num 8 last_change 2486 flags hashpspool stripe_width 0
注意:刚刚创建的两个资源池ssd_pool 和stat_pool 的 crush_ruleset 都是0,下面需要修改。
7 修改资源池存储规则
[root@ceph-admin getcrushmap]# ceph osd pool set ssd_pool crush_ruleset 1
set pool 28 crush_ruleset to 1
[root@ceph-admin getcrushmap]# ceph osd pool set stat_pool crush_ruleset 2
set pool 29 crush_ruleset to 2
[root@ceph-admin getcrushmap]# ceph osd dump|grep ssd
pool 28 'ssd_pool' replicated size 3 min_size 2 crush_ruleset 1 object_hash rjenkins pg_num 8 pgp_num 8 last_change 2488 flags hashpspool stripe_width 0
[root@ceph-admin getcrushmap]# ceph osd dump|grep stat
pool 29 'stat_pool' replicated size 3 min_size 2 crush_ruleset 2 object_hash rjenkins pg_num 8 pgp_num 8 last_change 2491 flags hashpspool stripe_width 0
# luminus 版本设置pool规则的语法是
[root@ceph-admin ceph]# ceph osd pool set ssd crush_rule ssd
set pool 2 crush_rule to ssd
[root@ceph-admin ceph]# ceph osd pool set stat crush_rule stat
set pool 1 crush_rule to stat
8 验证
验证前先看看ssd_pool 和stat_pool 里面是否有对象
[root@ceph-admin getcrushmap]# rados ls -p ssd_pool
[root@ceph-admin getcrushmap]# rados ls -p stat_pool
#这两个资源池中都没有对象
用rados命令 添加对象到两个资源池中
[root@ceph-admin getcrushmap]# rados -p ssd_pool put test_object1 /etc/hosts
[root@ceph-admin getcrushmap]# rados -p stat_pool put test_object2 /etc/hosts
[root@ceph-admin getcrushmap]# rados ls -p ssd_pool
test_object1
[root@ceph-admin getcrushmap]# rados ls -p stat_pool
test_object2
#对象添加成功
[root@ceph-admin getcrushmap]# ceph osd map ssd_pool test_object1
osdmap e2493 pool 'ssd_pool' (28) object 'test_object1' -> pg 28.d5066e42 (28.2) -> up ([0], p0) acting ([0,1,2], p0)
[root@ceph-admin getcrushmap]# ceph osd map stat_pool test_object2
osdmap e2493 pool 'stat_pool' (29) object 'test_object2' -> pg 29.c5cfe5e9 (29.1) -> up ([1], p1) acting ([1,0,2], p1)
上面验证结果可以看出,test_object1 存入osd.0中,test_object2 存入osd.1中。达到预期目的
ceph 指定OSD创建pool的更多相关文章
- Ceph 状态报警告 pool rbd has many more objects per pg than average (too few pgs?)
定位问题 [root@lab8106 ~]# ceph -s cluster fa7ec1a1-662a-4ba3-b478-7cb570482b62 health HEALTH_WARN pool ...
- 创建 Pool & VIP - 每天5分钟玩转 OpenStack(122)
上节完成了 LBaaS 配置,今天我们开始实现如下 LBaaS 环境. 环境描述如下: 1. 创建一个 Pool “web servers”. 2. 两个 pool member “WEB1” 和 “ ...
- ceph增加osd流程
假如需要新增一个主机名:osd4 ip:192.168.0.110的OSD1.在osd4创建挂载目录及放置配置文件的目录 ssh 192.168.0.110 (这里是从mon主机ssh到osd4主机) ...
- ceph之osd
一.删除osd ceph osd out 1ceph osd down 1systemctl stop ceph-osd@1ceph osd crush remove osd.1ceph osd rm ...
- 影响性能的关键部分-ceph的osd journal写
在前面一篇文章中,我们看到,当使用filestore时,osd会把磁盘分成data和journal两部分.这主要是为了支持object的transaction操作.我的想法是,ceph需要具有数据保护 ...
- 2018.5.24 lvm创建pool
在调试生产环境时遇到以下情况: 好奇心驱使下,发现是lvm的一个功能——lvm创建pool,就手动创建了相似的环境,操作截图如下: 主要命令: vgcreate -s 32M vg /dev/vdb1 ...
- Java如何在指定端口创建套接字?
在Java编程中,如何在指定端口创建套接字并连接到指定服务器的端口? 下面的例子演示了Socket类的Socket构造函数,并且使用getLocalPort(),getLocalAddress(),g ...
- ceph存储osd启动异常处理和正常启停操作
机器角色:cloudstack虚拟机的宿主机:ceph存储机器. 事件:ceph存储的物理机器由于内存异常,需要停机更换,仅仅是把该物理机上面的虚拟机迁移走,同时启动了停机维护,然后就直接关机.结果造 ...
- Openstack针对nova,cinder,glance使用ceph的虚拟机创建机制优化
今天在开源中国社区看到有例如以下一个问题: 已经成功把ceph作为cinder和 glance的后端,可是假设作为nova的后端,虚拟机启动速度非常慢,网上查了一下是由于openstack创建虚 ...
随机推荐
- UITableViewCell的移动
看到Metro大都会 这个App中扣款顺序有个cell可以移动,于是觉得是时候回忆一下UITableView的基本使用了.其实他这个移动cell的功能是系统自带的. 代码主要是这样: // // Vi ...
- spring-boot整合Cxf的webservice案例
1.运行环境 开发工具:intellij idea JDK版本:1.8 项目管理工具:Maven 4.0.0 2.Maven Plugin管理 <?xml version="1.0&q ...
- php strncasecmp()函数 语法
php strncasecmp()函数 语法 作用:比较字符串前n个字符,不区分大小写直线电机 语法:strncasecmp(string1,string2,length) 参数: 参数 描述 str ...
- php pow()函数 语法
php pow()函数 语法 作用:pow()函数的作用是将一个数进行n次方计算后返回,广东大理石平台 语法:pow(X,Y); 参数: 参数 描述 X 要做处理的数字 Y 指定n次方中的n数值 说明 ...
- PHP curl_init函数
curl_init — 初始化一个cURL会话 说明 resource curl_init ([ string $url = NULL ] ) 初始化一个新的会话,返回一个cURL句柄,供curl_s ...
- flutter中的列表组件
列表布局是我们项目开发中最常用的一种布局方式.Flutter 中我们可以通过 ListView 来定义列表项,支持垂直和水平方向展示.通过一个属性就可以控制列表的显示方向.列表有以下分类: 垂直列表 ...
- 在CentOS上部署kubernetes1.9.0集群
原文链接: https://jimmysong.io/kubernetes-handbook/cloud-native/play-with-kubernetes.html (在CentOS上部署kub ...
- NOIP 考前研究
NOIP 2017 试题研究 D1T1 小凯的疑惑 (45 min) 看到题面,大概是推数学公式. 先打暴力表,观察 \(a,b\) 与 \(n\) 的关系.猜想 \(a×b−a−b\). 引理:对于 ...
- arcpy 常用操作
目录: 通用操作 条件函数 前提: import arcpy from arcpy.sa import * 1.通用操作 设置工作路径:arcpy.env.workspace("path_o ...
- DB-概念-数据库:数据库/Database
ylbtech-DB-概念-数据库:数据库/Database 数据库是以一定方式储存在一起.能与多个用户共享.具有尽可能小的冗余度.与应用程序彼此独立的数据集合,可视为电子化的文件柜——存储电子文件的 ...