ceph集群mon将var目录打满了起不来,迅速解决~另外,五一期间课程有8折!
写在前面
关于mon的故障处理,松鼠哥在《ceph实战全指南》课程中已经详细讲了几种情况,本篇这种情况未讲到,因此这里就展开说说,课程还是希望大家支持一下,课程滞销,帮帮松鼠哥吧~
五一优惠大放送,课程在已打折的基础上再打骨折!感兴趣的老铁不要错过了
问题发现
有集群告警提示mon挂掉了~mon挂掉可不是小问题,赶紧上去一看,原来是/var
目录被打满了
1 | [root@test-mon1 twj]# df -h /var |
再查发现mon有报错,空间满了,是mon打满的,它的rocksdb占用空间超过208G
,那基本就是rocksdb导致的了
1 | [root@test-mon1 twj]# grep 'rocksdb' /var/log/message |
思路
mon是相当稳健的ceph组件,一般不会有问题,这个现象是空间占太多了,也比较好查,显然是rocksdb中存放了过多的内容,它主要有什么内容呢?在早前的文章中有一种情况,松鼠哥遇到的rocksdb占用空间很大的情况是osdmap异常引发的,首先查看一下mon的rocksdb的内容
1 | [root@test-mon1 twj]# ceph-kvstore-tool rocksdb /var/lib/ceph/mon/ceph-test-mon1/store.db list > /home/twj/mondblist |
35w行的内容,太多了,more
查看发现绝大部分都是logm
的内容,仔细看了下logm,发现是一些日志状态类的记录
1 | [root@test-mon1 twj]# grep 'logm' mondblist -c |
这些信息感觉也没什么用啊,34w行的记录,每个记录看着也不小,考虑将其删除,然后手工对rocksdb做compact清出空间.
解决
因为rocksdb中的logm只是记录集群相关日志状态的信息,它对集群正常功能运行几乎没有太多的影响,因此可以直接删除,但是,如果是别的情况,例如要手工裁剪的内容是osdmap,就不能直接删除完事,要考虑它的版本,这种情况的话还要考虑导入导出部份信息来进行裁剪的问题
,这里直接删除,然后手工做compact
1 | [root@test-mon1 twj]# ceph-kvstore-tool rocksdb /var/lib/ceph/mon/ceph-test-mon1/store.db rm-prefix logm |
rm-prefix
会持续大概15分钟,compact
也需要大概15分钟才完成,完成后查看磁盘情况,发现使用空间已经降下来了
1 | [root@-test-mon1 twj]$ df -h /var |
既然空间清出了,就可以拉起mon了,注意拉起前需要改一下权限
1 | [root@test-mon1 twj]# chown ceph.ceph /var/lib/ceph/mon/ceph-test-mon1/store.db/* |
拉起是ok的,过了一会,mon就正常加入集群了,完美解决~
总结
mon不常出问题,但mon太重要,以至于出问题会导致集群大问题,所以处理的速度要比较快,常见的monitor问题主要是它的rocksdb和时钟问题,这些在松鼠哥的《ceph实战全指南》课程中有详细介绍,有兴趣的老铁可以支持一下~
- 本文作者: 奋斗的松鼠
- 本文链接: http://www.strugglesquirrel.com/2024/04/30/拯救磁盘空间写满的monitor/
- 版权声明: 本博客所有文章除特别声明外,创作版权均为作者个人所有,未经允许禁止转载!