GitLab 502错误和独角兽总是重启

时间:2018-05-30 06:48:14

标签: gitlab gitlab-omnibus

我在 Ubuntu 系统中成功安装了 gitlab 。但是当我尝试通过 http://localhost:8181/gitlab 访问它时,它显示 502 Whoops,GitLab花了太多时间来回复。 我用Google搜索并尝试使用google搜索的方法,但没有用。我还尝试将 unicorn ['port']更改为不同的端口,但同样的错误。

我运行gitlab-ctl status并发现独角兽pid 一直在变化。

我在这里运行gitlab-ctl tail unicorn和日志:

    ==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
ArgumentError: Already running on PID:809 (or pid=/opt/gitlab/var/unicorn/unicorn.pid is stale)
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:195:in `pid='
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:127:in `start'
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  /opt/gitlab/embedded/bin/unicorn:23:in `load'
  /opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'

==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/bin/unicorn)

==> /var/log/gitlab/unicorn/current <==
2018-05-30_06:38:28.57658 master failed to start, check stderr log for details

==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
ArgumentError: Already running on PID:809 (or pid=/opt/gitlab/var/unicorn/unicorn.pid is stale)
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:195:in `pid='
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:127:in `start'
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  /opt/gitlab/embedded/bin/unicorn:23:in `load'
  /opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'

==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/bin/unicorn)

==> /var/log/gitlab/unicorn/current <==
2018-05-30_06:38:29.62413 failed to start a new unicorn master
2018-05-30_06:38:29.67502 starting new unicorn master
2018-05-30_06:38:30.38160 master failed to start, check stderr log for details

==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
ArgumentError: Already running on PID:809 (or pid=/opt/gitlab/var/unicorn/unicorn.pid is stale)
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:195:in `pid='
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:127:in `start'
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  /opt/gitlab/embedded/bin/unicorn:23:in `load'
  /opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'

==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/bin/unicorn)

==> /var/log/gitlab/unicorn/current <==
2018-05-30_06:38:31.43073 failed to start a new unicorn master
2018-05-30_06:38:31.48246 starting new unicorn master
2018-05-30_06:38:32.19747 master failed to start, check stderr log for details
2018-05-30_06:38:33.24646 failed to start a new unicorn master
2018-05-30_06:38:33.29837 starting new unicorn master

==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
ArgumentError: Already running on PID:809 (or pid=/opt/gitlab/var/unicorn/unicorn.pid is stale)
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:195:in `pid='
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:127:in `start'
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  /opt/gitlab/embedded/bin/unicorn:23:in `load'
  /opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'

==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/bin/unicorn)

==> /var/log/gitlab/unicorn/current <==
2018-05-30_06:38:34.00485 master failed to start, check stderr log for details
2018-05-30_06:38:35.05395 failed to start a new unicorn master
2018-05-30_06:38:35.10656 starting new unicorn master

==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
ArgumentError: Already running on PID:809 (or pid=/opt/gitlab/var/unicorn/unicorn.pid is stale)
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:195:in `pid='
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:127:in `start'
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  /opt/gitlab/embedded/bin/unicorn:23:in `load'
  /opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'

==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/bin/unicorn)

==> /var/log/gitlab/unicorn/current <==

希望有人能帮助我。提前致谢。

PS:我通过设置nginx['enable'] = false 禁用 Nginx 并在 apache2.conf

中添加proxy_pass
ProxyPass /gitlab http://127.0.0.1:8181/gitlab

和gitlab.rb:

gitlab_workhorse['enable'] = true
# gitlab_workhorse['ha'] = false
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"

unicorn['worker_timeout'] = 600
###! Minimum worker_processes is 2 at this moment
###! See https://gitlab.com/gitlab-org/gitlab-ce/issues/18771
unicorn['worker_processes'] = 2

### Advanced settings
# unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 12148

web_server['external_users'] = ['www-data']
web_server['username'] = 'www-data'
web_server['group'] = 'www-data'

nginx['enable'] = false

1 个答案:

答案 0 :(得分:1)

我遇到了与在CentOS 7.5 64位服务器上安装GitLab EE相同的问题。

enter image description here

您必须注意的最重要的事情是确保服务器处于性能的最低要求之下!

In the official documentation of GitLab,您的服务器必须至少具有2个核心和8GB RAM。

enter image description here

如果您的服务器少于2个内核和8GB RAM。您可以尝试进行Swap以获得更多内存,然后重新配置并重新启动GitLab。如果仍然有这种情况,那么注意有关Gitlab首次启动的另一个大而可怕的问题:

安装GitLab后可能需要很长时间才能加载第一页!

"GitLab is not responding." 502 on Ubuntu 14.04 after starting server

  

注意:如果您有一台性能较低的服务器,例如:1核和1GB RAM,则最多时间为502,即使您尝试将Swap切换为8GB RAM,也无法正常工作,这是唯一的方法可以做的就是使服务器的性能至少超过2核并且最低8GB RAM。

一些其他方法可帮助您找到更多详细的有用信息:

  • 我们可以使用gitlab-ctl tail获取详细信息,然后复制日志并查找警告,失败等关键字。

  • 您可以转到/var/log/gitlab的子目录以查找日志以获取一些信息。