Ceph日志分区占满及调试过程

    技术2025-04-18  7

    经过:

    Lotus在运行过程中报错,查看集群状态 ceph -s 后 timeout Ceph集群日志文件的默认目录在 /var/log/ceph Ceph的日志文件默认排序方法举例说明如下:

    ceph-mon.u0205.log ceph-mon.u0205.log.1 ceph-mon.u0205.log.2.gz ceph-mon.u0205.log.3.gz

    ceph-mon.u0205.log 是当前正在swap交换分区中编辑的日志,其余日志号码按升序排列,即 ceph-mon.u0205.log.1 是当前最新的日志。查看以往文档需要解包,解压.gz文档的命令如下:

    gzip -d ceph-mon.u0205.log.3.gz

    查看每个最新的日志后,发现问题如下:

    $ tail -n 50 ceph.log.1 cluster [WRN] Health check failed: mon u0205 is low on available space (MON_DISK_LOW) $ tail -n 50 ceph-mds.u0205.log.1 mds.beacon.u0205 is_laggy 16.1128 > 15 since last acked beacon mds.0.1301 skipping upkeep work because connection to Monitors appears laggy mds.beacon.u0205 initiating monitor reconnect; maybe we're not the slow one $ tail -n 50 ceph-mon.u0205.log.1 mon.u0205@0(leader).mds e1306 tick: resetting beacon timeouts due to mon delay (slow election?) of 20.0313s seconds log_channel(cluster) log [ERR] : Health check failed: mon u0205 is very low on available space (MON_DISK_CRIT) log_channel(cluster) log [INF] : Health check cleared: MON_DISK_LOW (was: mon u0205 is low on available space) Waiting after background flush error: IO error: No space left on device While appending to file: /var/lib/ceph/mon/ceph-u0205/store.db/003616.sst: No space left on device Accumulated background error counts: 1

    从日志中发现如下两个问题: 1、/var/lib/ceph 中容量不足。 2、与 mon 节点的连接缓慢。

    问题1解决方法 1、给 /var 分区预留足够的容量。 2、更改日志的输出文件上限(加速更迭)。 重要: 详尽的日志每小时可能超过 1GB ,如果你的系统盘满了,这个节点就会停止工作。 加速日志更迭 可以修改 /etc/logrotate.d/ceph 内的日志更迭选项来加快更迭。在更迭频率后增加一个日志 size 选项(达到此大小就更迭)来加快更迭(通过 cronjob ): 增加一个 size 选项。

    rotate 7 weekly size 500M compress sharedscripts

    然后,打开 crontab 编辑器。

    crontab -e

    最后,增加一条用以检查 /etc/logrorate.d/ceph 文件的语句,每 30 分钟检查一次 /etc/logrorate.d/ceph 文件。

    30 * * * * /usr/sbin/logrotate /etc/logrotate.d/ceph >/dev/null 2>&1

    参考: Ceph 进阶系列(一):Ceph日志和调试 Ceph官方文档

    Processed: 0.010, SQL: 9