通过top,发现prometheus进程占用CPU接近100%,这肯定有点异常。
gitlab-ctl tail prometheus 发现有报错的情况,提示空间不足。暂时不管空间的问题。
2024 -03-07_05:48:09.01515 ts = 2024 -03-07T05:48:09.014Z caller = main.go:1116 level = error err = "opening storage failed: lock DB directory: open /var/opt/gitlab/prometheus/data/lock: no space left on device"
于是就想关掉prometheus,参考 https://blog.csdn.net/yuer5531/article/details/105491190 关掉prometheus。
gitlab-ctl stop
vim /etc/gitlab/gitlab.rb //修改prometheus
gitlab-ctl reconfigure
gitlab-ctl start
gitlab-ctl reconfigure 执行失败,还是提示空间不足。
df 发现空间足够。
root@debian:~
Filesystem Size Used Avail Use% Mounted on
udev 3 .9G 0 3 .9G 0 % /dev
tmpfs 796M 11M 786M 2 % /run
/dev/sda1 25G 9 .5G 14G 41 % /
tmpfs 3 .9G 60K 3 .9G 1 % /dev/shm
tmpfs 5 .0M 0 5 .0M 0 % /run/lock
/dev/sdb1 2 .0T 869M 1 .9T 1 % /git-data
chatgpt 搜了一下空间不足,但是df查看是有空间的。提示inode 可能用完。于是用df -i 查看,果然inode用光。
root@debian:~
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 1014087 339 1013748 1 % /dev
tmpfs 1018501 440 1018061 1 % /run
/dev/sda1 1628800 1628800 0 100 % /
tmpfs 1018501 3 1018498 1 % /dev/shm
tmpfs 1018501 2 1018499 1 % /run/lock
/dev/sdb1 134217728 10076 134207652 1 % /git-data
现在就要找到什么地方用了这么多的inode。使用find /var/opt/gitlab/ -type f 。发现var/opt/gitlab/prometheus/data/wal/ 目录下存在大量的空文件。这和prometheus进程CPU占用过高有些巧合。估计就是这个地方文件过多导致。
据查prometheus是负责监控的,删掉这个目录似乎影响不大,于是删除整个目录。rm var/opt/gitlab/prometheus/data/wal/ -rf。
vim /etc/gitlab/gitlab.rb //修改prometheus
gitlab-ctl reconfigure
gitlab-ctl start
问题得到解决。