当前位置:网站首页>ceph详解之mon_osd_max_split_count
ceph详解之mon_osd_max_split_count
2022-07-19 05:16:00 【初码诛仙】
问题
ceph 在扩容的过程中,免不了会遇到osd数量达到一定程度以后,需要调整存储池的pg_num和pgp_num。一般在osd数量比较小的时候,可能没啥问题。但是当osd到达一定数量的时候,扩展pg的时候,可能会出现如下报错:
Error E2BIG: specified pg_num 4096 is too large (creating 2048 new PGs on ~60 OSDs would exceed the per-OSD max of 32 given by mon_osd_max_split_count); please increase the pg_num in smaller steps
根据报错,我们很明显指向了mon_osd_max_split_count这个参数。
我们的环境就是在48个osd扩展到60个osd(集群每个osd容许的最大pg是250个)的时候,需要将pg从2048调整到4096的时候出现的报错。我们不妨先查看一下集群的这个参数的值。我们使用如下命令查询:
ceph daemon osd.0 config show | egrep 'mon_osd_max_split_count'
有输出,输出如下:
"mon_osd_max_split_count": "32"
说明osd有对应的该参数的配置,并且的确和错误描述中的一致,是32.这个值是默认值。
我们再查一下mon试试,使用如下命令查询:
ceph daemon /var/run/ceph/ceph-mon.ceph-node01.asok config get mon_osd_max_split_count
也是有输出的,并且也和错误描述中的一致,说明mon也是有该参数配置的。如下:
{
"mon_osd_max_split_count": "32"
}
意义
mon_osd_max_split_count参数是干嘛的?从字面上看,就是mon 监控每个osd在分裂的时候,容许的最大分裂数量。的确是这样,ceph为了限制pg分裂的速度,设置了mon_osd_max_split_count这个参数。这个参数表示【在分裂的时候,每个osd容许的最大分裂数量】。
那么,在我们的环境下,osd从48个扩展到60个的时候,也就是pg应该从2048(单个osd最大pg数为250,48个osd的时候,假如一个pool的占整个集群100%的数据量,该pool最优的pg数量是2048)开始调整。理论上应该最高容许调整到如下:
2048+32*60=3968
我们将上面的计算过程写成脚本:
#!/bin/bash
max_inc=`ceph daemon /var/run/ceph/ceph-mon.ceph-node01.asok config get mon_osd_max_split_count 2>&1 \
| tr -d '\n ' | sed 's/.*"\([[:digit:]]\+\)".*/\1/'`
pg_num=`ceph osd pool get volumes pg_num | cut -f2 -d: | tr -d ' '`
echo "当前 pg_num value: $pg_num, 每个osd每次最大分列数: $max_inc"
osd_num=`ceph osd ls |wc -l`
next_pg_num="$(($pg_num+$(($max_inc * $osd_num))))"
echo "最大扩容 pg_num: $next_pg_num"
没错!当mon_osd_max_split_count保持默认的32的配置的时候,按照报错,我们的确需要每次扩容小一些的pg_num(increase the pg_num in smaller steps)。60个osd,最适合的pg_num是4096,那我们应该先扩容到3968,再扩容到4096。
处理方法
分布扩容
按照错误描述,分布扩容。先扩容到3968,在扩容到4096.该方法是可行的,不过就是集群要两次扩容(每次扩容可是会基本引起集群不可用的),两次数据平衡。不太推荐。
调整mon_osd_max_split_count
既然是mon_osd_max_split_count参数控制的,那我们可以调整该参数。可以走先动态注入,再改配置文件的方法。我们先用如下两个命令,将mon_osd_max_split_count值动态改成64:
ceph tell mon.* injectargs '--mon_osd_max_split_count 64'
ceph tell osd.* injectargs '--mon_osd_max_split_count 64'
然后在deploy(我的集群是ceph-dploy配置的)节点,修改ceph配置文件,在配置文件的mon和osd字段,添加如下配置:
[mon]
mon osd max split count = 64
[osd]
mon osd max split count = 64
将配置文件,同步到各节点:
ceph-deploy --overwrite-conf config push ceph-node0{1..6}
最后,参考ceph 存储池pg和pgp调整调整pg_num和pgp_num的值。
边栏推荐
- 正则表达式的设计
- 黑马程序员UDP入门
- Openstack uses dashboard to perform image operations, manage instances, and other operations
- Leetcode:20. 有效的括号【三种思路+不同语言实现】
- Computer 408+ database [suitable for postgraduate entrance examination or final review]
- Leshan normal programming competition 2020-c: maximum product [thinking]
- ftp port
- ESM测向误差对定位误差的影响分析
- CSV intro
- 六大集合List、Set、Map、Queue、Deque、Stack的遍历方式总结
猜你喜欢
雷达基础知识
2022-7-11 第八小组 顾宇佳 学习笔记(Js)
FPGA majority voter (including code)
Network Security Learning (XXIII) firewall
FPGA skimming p1:1-out-of-4 multiplexer, asynchronous reset Series T trigger, parity check, shift splicing multiplication
網絡安全學習(十七)VlAN
2022-7-18 guyujia's study notes of group 8
After ise14.7 was installed in win10 system, the software flashed back and the driver could not be installed normally
南京大学计算方法(数值分析)期末复习笔记
网络安全学习(十六)
随机推荐
Unity实用框架(四)全局数据管理框架
【PTA】7-24 约分最简分式 (15 分)
Panzer_Jack 的 个人博客成立日
[2022/7/17]科研整理
Stm32f4 PWM capture (rising edge / falling edge / high and low level time) detailed explanation (including code)
川菜菜谱(一)
Leshan normal programming competition 2020-e: divide stones [01 backpacks]
2022 -7-18 第八小组 顾宇佳 学习笔记
iptables examples
ZTE ZXR10 5250 command hints
乐山师范程序设计大赛2020-B: 设计网页【判素数】
使用Google colab进行机器学习的经验
Leshan normal programming competition 2020-c: maximum product [thinking]
Leshan normal programming competition 2020-a: good pairs
CA gem5 stats.txt 统计信息
Reference for Ruijie Switch Configuration
网安学习(二一)NAT 动态路由
Servlet概述
2021-09-30
黑马程序员线程通信【了解】