“CentOS GitLab 修复”这个问题比较宽泛,一般取决于具体故障现象。下面我按最常见场景给你一套排查 + 修复思路,你可以对照使用;如果还不行,把报错日志贴出来我可以更精准帮你。
sudo gitlab-ctl status
常见状态:
run ✅ 正常down ❌ 服务异常start / restart 中free -h
df -h
top
常见问题:
unicorn / puma 没启动sudo gitlab-ctl restart
如果仍 502:
sudo gitlab-ctl tail
重点看:
puma
unicorn
nginx
常见解决:
sudo systemctl restart gitlab-runsvdir
sudo gitlab-ctl reconfigure
ss -lntp | grep 80
ss -lntp | grep 443
sudo gitlab-ctl restart nginx
如果端口冲突(如 Apache):
systemctl stop httpd
systemctl disable httpd
sudo gitlab-ctl status sshd
测试:
ssh -T git@your-gitlab-domain
修复:
sudo gitlab-ctl restart sshd
sudo gitlab-ctl tail postgresql
database is not accepting commands修复:
sudo gitlab-ctl stop
sudo chown -R gitlab-psql:gitlab-psql /var/opt/gitlab/postgresql
sudo gitlab-ctl start
⚠️ 不要手动删数据库文件
sudo gitlab-ctl stop
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
如果还失败:
sudo gitlab-ctl upgrade
sudo gitlab-rake gitlab:check
sudo gitlab-rake gitlab:sanitize
⚠️ CentOS 7 官方源已下线,会导致:
临时修复:
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
✅ 建议迁移到:
gitlab-ctl backup
备份路径:
/var/opt/gitlab/backups
重装:
yum reinstall gitlab-ee
恢复:
gitlab-backup restore BACKUP=timestamp
| 现象 | 推荐操作 |
|---|---|
| 502 | gitlab-ctl restart |
| 磁盘满 | df -h 清理 |
| 升级后挂 | reconfigure |
| SSH 不通 | 检查 sshd |
| 完全乱 | 备份 + 重装 |
如果你愿意,请告诉我:
gitlab-ctl tail 的最后 30 行日志我可以直接帮你精确定位并给出修复命令 ✅