GitLab数据库引起的502错误问题及解决方案

时间:2024-03-16 16:37:29

1.打开GitLab的主页地址http://192.168.3.43:8082/报错:
GitLab数据库引起的502错误问题及解决方案
2.重启或检查状态发现都正常。

[[email protected] unicorn]# sudo gitlab-ctl status
run: alertmanager: (pid 98218) 1895s; run: log: (pid 66884) 2683s
run: gitaly: (pid 98231) 1895s; run: log: (pid 66906) 2683s
run: gitlab-monitor: (pid 98242) 1894s; run: log: (pid 66888) 2683s
run: gitlab-workhorse: (pid 98250) 1894s; run: log: (pid 66900) 2683s
run: logrotate: (pid 98263) 1893s; run: log: (pid 66904) 2683s
run: nginx: (pid 98269) 1893s; run: log: (pid 66902) 2683s
run: node-exporter: (pid 98281) 1893s; run: log: (pid 66890) 2683s
run: postgres-exporter: (pid 98291) 1892s; run: log: (pid 66892) 2683s
run: postgresql: (pid 98299) 1892s; run: log: (pid 66894) 2683s
run: prometheus: (pid 98308) 1891s; run: log: (pid 66882) 2683s
run: redis: (pid 98315) 1891s; run: log: (pid 66880) 2683s
run: redis-exporter: (pid 98319) 1891s; run: log: (pid 66886) 2683s
run: sidekiq: (pid 98325) 1890s; run: log: (pid 66898) 2683s
run: unicorn: (pid 98332) 1890s; run: log: (pid 66896) 2683s

3.检查端口号:
GitLab数据库引起的502错误问题及解决方案
发现端口没有被占用。
4.检查刷新配置:

gitlab-ctl reconfigure

终于发现错误信息:

Running handlers:
There was an error running gitlab-ctl reconfigure:

bash[migrate gitlab-rails database] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20190308-65247-12ck9rp" ----
STDOUT: rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
 Is the server running locally and accepting
 connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:52:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:db:configure
(See full trace by running task with --trace)
STDERR:
---- End output of "bash"  "/tmp/chef-script20190308-65247-12ck9rp" ----
Ran "bash"  "/tmp/chef-script20190308-65247-12ck9rp" returned 1

或者gitlab-ctl tail
GitLab数据库引起的502错误问题及解决方案
GitLab数据库引起的502错误问题及解决方案
6.解决了以后再次检查端口号:

[[email protected] unicorn]# netstat  -anp  |grep 8888
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN      98269/nginx: master
unix  3      [ ]         STREAM     CONNECTED     83131258 98888/postgres: git  /var/opt/gitlab/postgresql/.s.PGSQL.5432