参考 ceph - 扩容记录 文档记录了如何进行 ceph 扩容的部署过程
最后一步, 需要对 ceph crushmap 进行重定义
新加入 3 台存储节点, 每个存储节点具有 10 个 OSD 节点, 每个 OSD 对应 4TB 空间, 即共增加 3* 10 * 4TB = 120 TB
由于一直都有业务在 ceph 存储中使用, 假如立即把所有新加入的 ceph 节点存储使用率设定为 100% 会导致 ceph 集群处于一个维护期中, CPU, 网络带宽都会被需要进行恢复的 ceph 影响, 所有业务都会出现数据卡顿问题,
因此, 计划每天晚上只对 ceph osd 进行部分部分扩容,
3台存储节点, 每个存储节点具有 10 个OSD 节点, 每个 OSD 对应 4TB 空间, 每个 OSD 晚上扩展 200GB 空间, 即 3 * 10 * 200GB = 6TB 空间
我们从 2015-12-26 开始, 对 ceph 通过修改 weight 方法, 对 ceph 进行扩容, 每次扩容约为 CEPH 添加 6 TB 磁盘空间
参考脚本
#!/bin/bash # # edit by terry.zeng@vipshop.com # last_version: 2015-12-25 # modify: reweight -> 0.5 || ceph status ( grep 'misplaced' ) # # 目标: 自动进行 ceph weight 调整, # 条件 # 调整时间 start_time 1, end_time 8 之间 # ceph 必须是 health_ok 状态 # 最大可用 weight 10 # 需要调整的主机 reweight_host # # 邮件辅助 sh: /root/ceph/check_ceph_reweight.sh [只有发生 ceph -s [出现 misplace] 或其状态改变时候才发邮件 # time=`date +%Y-%m-%d-%H%M%S` savecrushfile='/root/ceph/crushmap.txt' start_time=1 end_time=7 reweight=0.5 reweight_host='hh-yun-ceph-cinder014-128054 hh-yun-ceph-cinder021-128071 hh-yun-ceph-cinder022-128072' max_weight=10.000 now=`date +%k` ### time if [[ $now -lt $start_time ]] || [[ $now -ge $end_time ]] then exit fi #### ceph status ceph -s | grep 'misplaced' > /dev/null if [ $? -eq 0 ] then exit fi echo $time 'reweight start' >> /root/ceph/reweight_record.txt ### rewieght if [ -f $savecrushfile ] then mv $savecrushfile $savecrushfile-$time fi ceph osd getcrushmap -o /root/ceph/crushmap.dump crushtool -d /root/ceph/crushmap.dump -o /root/ceph/crushmap.txt for host in $reweight_host do weight=`grep $host $savecrushfile | grep item | awk '{print $4}'` line=`grep --line-number $host $savecrushfile | grep item | awk -F: '{print $1}'` new_weight=`echo $weight + $reweight | bc -l` if [ "$new_weight" == "$max_weight" ] then exit fi sed -i "$line"s#$weight#$new_weight# $savecrushfile done crushtool -c /root/ceph/crushmap.txt -o /root/ceph/crushmap.done ceph osd setcrushmap -i /root/ceph/crushmap.done目前在扩容期间, 对 ceph 集群执行了下面的参数修改
ceph tell osd.\* injectargs '--osd_max_backfills 1 --osd_recovery_max_active=1 --osd_disk_thread_ioprio_class idel --osd_disk_thread_ioprio_priority 7 --osd_recovery_threads 1 --osd_recovery_op_priority 10 --osd_backfill_scan_min 64 --osd_backfill_scan_max 512’