加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

gitlab 打开页面出现502错误解决办法

发布时间:2020-12-13 17:54:18 所属栏目:Linux 来源:网络整理
导读:GitLab常用命令 sudo?gitlab-ctl?start????#?启动所有?gitlab?组件;sudo?gitlab-ctl?stop????????#?停止所有?gitlab?组件;sudo?gitlab-ctl?restart????????#?重启所有?gitlab?组件;sudo?gitlab-ctl?status????????#?查看服务状态;sudo?gitlab-ctl?reconf

GitLab常用命令

sudo?gitlab-ctl?start????#?启动所有?gitlab?组件;
sudo?gitlab-ctl?stop????????#?停止所有?gitlab?组件;
sudo?gitlab-ctl?restart????????#?重启所有?gitlab?组件;
sudo?gitlab-ctl?status????????#?查看服务状态;
sudo?gitlab-ctl?reconfigure????????#?重新配置更新
sudo?vim?/etc/gitlab/gitlab.rb????????#?修改默认的配置文件;
gitlab-rake?gitlab:check?SANITIZE=true?--trace????#?检查gitlab;
sudo?gitlab-ctl?tail????????#?查看日志;


解决思路:

1.?首先确认部署gitlab机器硬件是否满足条件:cpu:2核和内存:8g (最低性能要求),如果不满足,该问题只能通过更换机器解决。

2.?检查gitlab是否是使用8080端口,且8080端口是否被抢占使用(大部分都是改原因导致)

修改gitlab的默认端口

>>>?vim??/etc/gitlab/gitlab.rb

#?大概在240行左右
unicorn['listen']?=?'127.0.0.1'
unicorn['port']?=?8181

#?每次重新配置,都需要执行sudo?gitlab-ctl?reconfigure?
>>>?sudo?gitlab-ctl?reconfigure

3. 检查gitlab的状态,查看nginx日志,查看进程状态,在做判断。

使用gitlab-ctl status命令查看gitlab的状态

>>>?gitlab-ctl?status
run:?logrotate:?(pid?21402)?86s;?run:?log:?(pid?1209)?3957915s
run:?nginx:?(pid?21457)?85s;?run:?log:?(pid?1207)?3957915s
run:?postgresql:?(pid?22444)?44s;?run:?log:?(pid?1201)?3957915s
run:?redis:?(pid?21790)?73s;?run:?log:?(pid?1200)?3957915s
run:?sidekiq:?(pid?22443)?44s;?run:?log:?(pid?1205)?3957915s
run:?unicorn:?(pid?1096)?55171s,?got?TERM;?run:?log:?(pid?1202)?3957915s

查看gitlab的错误日志记录

>>>?cd?/var/log/gitlab/nginx/
>>>?cat?cat?gitlab_error.log

2018/08/07?03:12:32?[error]?27179#0:?*56?upstream?prematurely?closed?connection?while?reading?response?header?from?upstream,?client:?192.168.3.240,?server:?192.168.3.99,?request:?"GET?/?HTTP/1.1",?upstream:?"http://unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket:/",?host:?"192.168.3.99:12345"
2018/08/07?03:17:52?[error]?21461#0:?*1?connect()?to?unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket?failed?(111:?Connection?refused)?while?connecting?to?upstream,?client:?192.168.3.221,?host:?"192.168.3.99:12345"
2018/08/07?03:21:37?[error]?21462#0:?*3?connect()?to?unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket?failed?(111:?Connection?refused)?while?connecting?to?upstream,?host:?"192.168.3.99:12345"

使用命令:gitlab-ctl tail?用来获取详细信息

>>>?gitlab-ctl?tail?


==>?/var/log/gitlab/postgresql/current?<==
2019-12-24_10:30:01.87878?FATAL:??could?not?write?lock?file?"postmaster.pid":?No?space?left?on?device

==>?/var/log/gitlab/unicorn/current?<==
2019-12-24_10:30:02.15926?master?failed?to?start,?check?stderr?log?for?details

==>?/var/log/gitlab/postgresql/current?<==
2019-12-24_10:30:02.90281?FATAL:??could?not?write?lock?file?"postmaster.pid":?No?space?left?on?devic

比如这里提示错误:could not write lock file "postmaster.pid": No space left on device,告诉我们由于电脑硬盘没有空余存储空间来存储postmaster.pid文件,导致启动失败。

参考文章:
https://stackoverflow.com/questions/50598018/gitlab-502-error-and-unicorn-always-restart

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读