温馨提示×

centos gitlab怎么重启

小樊
44
2026-09-06 00:27:24
栏目: 智能运维

在 CentOS 上重启 GitLab,通常取决于你是通过官方 Omnibus 包安装的,还是源码/容器安装的。最常见的是 Omnibus 安装方式。


一、Omnibus 方式安装(最常见)

1️⃣ 重启 GitLab 所有服务

sudo gitlab-ctl restart

2️⃣ 只重启某个服务(可选)

例如只重启 nginx:

sudo gitlab-ctl restart nginx

常用服务名:

  • nginx
  • unicorn / puma
  • sidekiq
  • postgresql
  • redis

二、查看 GitLab 状态

sudo gitlab-ctl status

三、通过 systemd 重启(CentOS 7+)

GitLab 本质是一个 systemd 服务:

sudo systemctl restart gitlab-runsvdir

或:

sudo systemctl restart gitlab

四、Docker 方式安装(如果你是用容器)

docker restart gitlab

(容器名可能不同,用 docker ps 查看)


五、修改配置后重启(重要)

如果你改了 /etc/gitlab/gitlab.rb

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

六、常见问题

GitLab 启动慢?

正常现象,尤其是第一次重启,可能 1–3 分钟。

重启后无法访问?

检查:

sudo gitlab-ctl status
sudo systemctl status gitlab-runsvdir

如果你能告诉我:

  • CentOS 版本(6 / 7 / 8)
  • GitLab 安装方式( Omnibus / Docker / 源码)

我可以给你更精确的重启命令。

0