一次gitlab 502故障解决过程

  1. 通过top,发现prometheus进程占用CPU接近100%,这肯定有点异常。
  2. gitlab-ctl tail prometheus 发现有报错的情况,提示空间不足。暂时不管空间的问题。
bash 复制代码
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"
  1. 于是就想关掉prometheus,参考 https://blog.csdn.net/yuer5531/article/details/105491190 关掉prometheus。
bash 复制代码
gitlab-ctl stop
vim /etc/gitlab/gitlab.rb //修改prometheus
gitlab-ctl reconfigure
gitlab-ctl start
  1. gitlab-ctl reconfigure 执行失败,还是提示空间不足。
  2. df 发现空间足够。
bash 复制代码
root@debian:~# df -h
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
  1. chatgpt 搜了一下空间不足,但是df查看是有空间的。提示inode可能用完。于是用df -i 查看,果然inode用光。
bash 复制代码
root@debian:~# df -i
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
  1. 现在就要找到什么地方用了这么多的inode。使用find /var/opt/gitlab/ -type f。发现var/opt/gitlab/prometheus/data/wal/ 目录下存在大量的空文件。这和prometheus进程CPU占用过高有些巧合。估计就是这个地方文件过多导致。
  2. 据查prometheus是负责监控的,删掉这个目录似乎影响不大,于是删除整个目录。rm var/opt/gitlab/prometheus/data/wal/ -rf。
bash 复制代码
vim /etc/gitlab/gitlab.rb //修改prometheus
gitlab-ctl reconfigure
gitlab-ctl start
  1. 问题得到解决。
相关推荐
一念一花一世界5 小时前
Arbess从初级到进阶(9) - 使用Arbess+GitLab实现C++项目自动化部署
c++·ci/cd·gitlab·arbess
X***48966 小时前
GitLab
gitlab
一世一生命6 小时前
GitLab Package依赖管理:从 Dependabot 到 Renovate 的迁移实践和两者对比
gitlab
t***L2666 小时前
GitLab API使用实例
运维·gitlab
x***B41113 小时前
GitLab Runner配置教程
gitlab
9***Y4813 小时前
GitLab CI/CD配置教程
ci/cd·gitlab
y***548815 小时前
GitLab CI缓存配置
缓存·ci/cd·gitlab
p***c94916 小时前
GitLab CI/CD变量
git·ci/cd·gitlab
O***p60416 小时前
GitLab CI/CD自动化部署实践
ci/cd·自动化·gitlab
知兀1 天前
私有化部署的gitlab的push failed问题,使用http远程连接(使用token或用户、密码)
gitlab