Postgresql Gitlab 500错误:PG::ConnectionBad
我正在运行Gitlab CE v8.11.3-CE.1 我家断电了,所以我的Gitlab服务器突然关闭了。我重新启动它,它给我一个500的错误。 当我重新配置sudo gitlab ctl时,我会在日志中看到:Postgresql Gitlab 500错误:PG::ConnectionBad,postgresql,gitlab,Postgresql,Gitlab,我正在运行Gitlab CE v8.11.3-CE.1 我家断电了,所以我的Gitlab服务器突然关闭了。我重新启动它,它给我一个500的错误。 当我重新配置sudo gitlab ctl时,我会在日志中看到: [execute] psql: could not connect to server: Connection refused Is the server running locally and accepting connections
[execute] psql: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
这是gitlab.rb的“我的数据库”部分:
# gitlab_rails['db_adapter'] = "postgresql"
# gitlab_rails['db_encoding'] = "unicode"
# gitlab_rails['db_collation'] = nil
# gitlab_rails['db_database'] = "gitlabhq_production"
# gitlab_rails['db_pool'] = 10
# gitlab_rails['db_username'] = "gitlab"
# gitlab_rails['db_password'] = nil
# gitlab_rails['db_host'] = nil
# gitlab_rails['db_port'] = 5432
# gitlab_rails['db_socket'] = nil
# gitlab_rails['db_sslmode'] = nil
# gitlab_rails['db_sslrootcert'] = nil
我没有更换任何主机或任何东西。帮助。感谢@twk3解决了我的问题! 解决方案:
sudo gitlab-ctl stop
sudo systemctl stop gitlab-runsvdir.service
ps aux | grep postgre (check if there are any postgres processes; shouldn't be)
sudo rm /var/opt/gitlab/postgresql/data/postmaster.pid
sudo systemctl start gitlab-runsvdir.service
sudo gitlab-ctl reconfigure
而且它有效 那么,您的数据库是否正在运行并接受连接?错误消息告诉您该做什么,这里没有人可以帮您。@JakubKania是的,postgresql正在运行,这一点已被
ps aux | grep postgresql
证明,您是否已验证可以使用套接字连接到它?似乎由于缺少配置的db_主机,它将用于套接字而不是端口。@JakubKania如何验证我可以通过套接字连接到它?我有相同的错误,但没有这样的文件/var/opt/gitlab/postgresql/data/postmaster.pid
如果没有pid,请转到下一步