GitLab架构图
Gitlab各组件作用
-Nginx:静态web服务器。
-gitlab-shell:用于处理Git命令和修改authorized keys列表。
-gitlab-workhorse: 轻量级的反向代理服务器。
-logrotate:日志文件管理工具。
-postgresql:数据库。
-redis:缓存数据库。
-sidekiq:用于在后台执行队列任务(异步执行)。
-unicorn:An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的。
Gitlab各组件启动停止命令
GitLab
gitlab-ctl start gitlab-ctl stop gitlab-ctl restart gitlab-ctl status gitlab-ctl reconfigure
Nginx
gitlab-ctl start nginx gitlab-ctl stop nginx gitlab-ctl restart nginx gitlab-ctl status nginx
Unicorn
gitlab-ctl start unicorn gitlab-ctl stop unicorn gitlab-ctl restart unicorn gitlab-ctl status unicorn
Sidekiq
gitlab-ctl start sidekiq gitlab-ctl stop sidekiq gitlab-ctl restart sidekiq gitlab-ctl status sidekiq
PostgreSQL
gitlab-ctl start postgresql gitlab-ctl stop postgresql gitlab-ctl restart postgresql gitlab-ctl status postgresql
Redis
gitlab-ctl start redis gitlab-ctl stop redis gitlab-ctl restart redis gitlab-ctl status redis
全局
等同于 GitLab 服务的效果,仅供参考
systemctl start gitlab-runsvdir.service systemctl stop gitlab-runsvdir.service systemctl status gitlab-runsvdir.service systemctl restart gitlab-runsvdir.service
GitLab能打开,但总是出现502错误
GitLab 所需内存最低为4G,若服务器配置太低会出现502错误
使用什么数据库来存储 GitLab 数据
PostgreSQL数据库
相关路径
GitLab 配置文件: /etc/gitlab/gitlab.rb
GitLab 及所有组件配置: /opt/gitlab
GitLab Repository 存储目录: /var/opt/gitlab/git-data
GitLab 备份目录: /var/opt/gitlab/backups
GitLab 各组件日志目录: /var/log/gitlab
PostgreSQL组件
PostgreSQL 安装目录: /var/opt/gitlab/postgresql
PostgreSQL 日志目录: /var/log/gitlab/postgresql
PostgreSQL-Exporter 日志目录: /var/log/gitlab/postgres-exporter
PostgreSQL 数据目录: /var/opt/gitlab/postgresql/data
Redis组件
Redis 安装目录: /var/opt/gitlab/redis
Redis 日志目录: /var/log/gitlab/redis
gitlab常用命令:
命令功能 |
执行命令 |
---|---|
重启配置,并启动gitlab服务 |
sudo gitlab-ctl reconfigure |
启动所有 gitlab |
sudo gitlab-ctl start |
重新启动GitLab |
sudo gitlab-ctl restart |
停止所有 gitlab |
sudo gitlab-ctl stop |
查看服务状态 |
sudo gitlab-ctl status |
查看Gitlab日志 |
sudo gitlab-ctl tail |
修改默认的配置文件 |
sudo vim /etc/gitlab/gitlab.rb |
检查gitlab |
gitlab-rake gitlab:check SANITIZE=true –trace |
参考链接:
Gitlab基础知识介绍 – 哈喽哈喽111111 – 博客园 (cnblogs.com)
gitlab访问错误Whoops, GitLab is taking too much time to respond – 腾讯云开发者社区-腾讯云 (tencent.com)