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创建虚 ...
随机推荐
- JS谷歌浏览器断点调试
1.找到对应的文件 按F12打开网页调试工具,默认打开的是Elements,显示的是网页标签元素.选择Source,在左侧找到对应的js代码文件(这里是在page标签上找到的) 1.1.如何找到web ...
- buuctf | [强网杯 2019]随便注
1' and '0,1' and '1 : 单引号闭合 1' order by 3--+ : 猜字段 1' union select 1,database()# :开始注入,发现正则过滤 1' an ...
- CTF | bugku | 秋名山车神
''' @Modify Time @Author ------------ ------- 2019/8/31 19:55 laoalo ''' import requests from lxml i ...
- python练习题返回列表中的第二小的元素的下标
# 第三题:返回列表中的第二小的元素的下标 # 1.参数是一个列表,元素全部是整数 # 2.返回第二小的元素的下标 def seconde_min(lt): n = len(lt) if lt[0]& ...
- gradle spring 配置解释
plugins { id 'java' id 'eclipse' id 'idea' # 统一springboot版本号 id 'org.springframework.boot' version ' ...
- 使用 jQuery 实现 radio 的选中与反选
使用 jQuery 实现 radio 的选中与反选 我们知道在 Html 中当我们选中一个radio后,再次点击该 radio,那么该 radio 依然是一个选中的状态,但是有时我们需要实现这样的逻辑 ...
- Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.s ...
- javaIO流(一)--File类的基本使用
一.File文件操作类 在java语言中提供有对于文件操作系统的支持,这个支持就在java.io.File类中进行了定义,也就是说在整个java.io包中File类是唯一一个与文件本身操作有关的类(创 ...
- javascript 计算两个整数的百分比值
///计算两个整数的百分比值 function GetPercent(num, total) { num = parseFloat(num); total = parseFloat(total); i ...
- Codefores 506A Mr. Kitayuta, the Treasure Hunter( DP && dfs )
A. Mr. Kitayuta, the Treasure Hunter time limit per test 1 second memory limit per test 256 megabyte ...