gitlab 安装后启动不了,出现错误:The GitLab Unicorn web server is not running. 解决方法

我跟着 GitLab官方教程安装过程中并有没有出现错误,但是当我试图运行时出错,如下。
$ sudo /etc/init.d/gitlab restart
 Removing stale Unicorn web server pid. This is most likely caused by the web server crashing the last time it ran.
 Shutting down GitLab Sidekiq
 Shutting down GitLab Workhorse
 .
 GitLab is not running.
 Starting GitLab Unicorn
 Starting GitLab Sidekiq
 Starting GitLab Workhorse
 master failed to start, check stderr log for details

The GitLab Unicorn web server is not running.
 The GitLab Sidekiq job dispatcher with pid 26512 is running.
 The GitLab Workhorse with pid 26464 is running.

错误信息:The GitLab Unicorn web server is not running.

这个提示说明 gitlab web 服务没有运行。 我根据提示:`master failed to start, check stderr log for details`,这句话去查看启动日志(日志路径:/home/git/gitlab/log/unicorn.stderr.log)。
sudo vi /home/git/gitlab/log/unicorn.stderr.log
我发现有错误信息,如下:
I, [2016-09-22T11:27:45.312845 #23039] INFO -- : Refreshing Gem list
I, [2016-09-22T11:27:53.343771 #23039] INFO -- : listening on addr=/home/git/gitlab/tmp/sockets/gitlab.socket fd=14
E, [2016-09-22T11:27:53.352130 #23039] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2016-09-22T11:27:53.352190 #23039] ERROR -- : retrying in 0.5 seconds (4 tries left)
E, [2016-09-22T11:27:53.853991 #23039] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2016-09-22T11:27:53.854062 #23039] ERROR -- : retrying in 0.5 seconds (3 tries left)
E, [2016-09-22T11:27:54.356020 #23039] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2016-09-22T11:27:54.356095 #23039] ERROR -- : retrying in 0.5 seconds (2 tries left)
E, [2016-09-22T11:27:54.858235 #23039] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2016-09-22T11:27:54.858349 #23039] ERROR -- : retrying in 0.5 seconds (1 tries left)
E, [2016-09-22T11:27:55.358855 #23039] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2016-09-22T11:27:55.358936 #23039] ERROR -- : retrying in 0.5 seconds (0 tries left)
E, [2016-09-22T11:27:55.859165 #23039] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
Errno::EADDRINUSE: Address already in use - bind(2) for 127.0.0.1:8080
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:185:in `bind'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:185:in `new_tcp_server'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:165:in `bind_listen'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:242:in `listen'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `block in bind_new_listeners!'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `each'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `bind_new_listeners!'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:138:in `start'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/unicorn-4.9.0/bin/unicorn_rails:209:in `<top (required)>'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/bin/unicorn_rails:23:in `load'
 /home/git/gitlab/vendor/bundle/ruby/2.3.0/bin/unicorn_rails:23:in `<top (required)>'
其中这条错误:Errno::EADDRINUSE: Address already in use - bind(2) for 127.0.0.1:8080 ,我们看到它提示 8080 端口已经在使用中了,这时我想起来, Tomcat 服务默认占用8080 商品,问题找到了。

解决方法 :

修改 gitlab/config/unicorn.rb  里的监听端口,如下:
listen "127.0.0.1:8080", :tcp_nopush => true
找到这一行,将其它 8080 端口修改为 8081 或其它没有占用的端口,如下:
listen "127.0.0.1:8081", :tcp_nopush => true
修改完后重启 gitlab 已经正常启动
$ sudo /etc/init.d/gitlab restart
or
$ sudo service gitlab start
赞(52) 打赏
未经允许不得转载:优客志 » 系统运维
分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏