一次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. 问题得到解决。
相关推荐
极小狐2 天前
干掉流水线里的长期密钥:用 OIDC 让 CI/CD 与云以临时凭证对接
microsoft·ci/cd·gitlab·devops·ci·cd·oidc
snow@li2 天前
服务器运维:阿里云安装软件gitlab/智能体协助安装/智能体协同运维
运维·gitlab
极小狐3 天前
CI 流水线提速实战:缓存设计与依赖代理的工程实践
缓存·ci/cd·gitlab·devops
DevOps老兵4 天前
AI Infra实战11:模型部署Pipeline——CI/CD自动化
人工智能·ci/cd·ai·自动化·gitlab
极小狐4 天前
从复制粘贴到可复用组件:极狐GitLab CI/CD 组件目录实战
java·ci/cd·gitlab·devops·组件化
极小狐4 天前
用 Flow 编排 Agent 智能体:极狐GitLab Duo 自定义工作流实战
ai·gitlab·agent·devops·flow·duo
陈皮糖..4 天前
基于 Kubernetes 与 GitLab CI/CD 的云原生自动化交付平台
运维·ci/cd·云原生·架构·kubernetes·自动化·gitlab
11路没有终点5 天前
GitLab CI/CD 高级模式实战:include 模板库 / trigger 子流水线 / matrix 并行
ci/cd·gitlab
11路没有终点5 天前
GitLab CE CI/CD 入门指引手册:从零搭建第一条流水线
ci/cd·gitlab
2501_928996226 天前
Agent 开发的 API 选型:从 Function Calling 到多模型协作的中科热备底层逻辑
服务器·重构·gitlab