当部署时请求到达我的服务器时,它失败了。我在 AWS EC2 中使用 Ubuntu。当我使用 Elastic Load Balancer 时,我已经尝试从 Load Balancer 注销并再次注册我的实例,以便同时启动独角兽服务器。同样在开始独角兽之前,我正在删除unicorn.pid
inst=$(ec2metadata --instance-id)`
aws elb deregister-instances-from-load-balancer --load-balancer-name my_load_balancer_name --instances $inst
echo "Server deregistered from Load Balancer"
sleep 10s
file="/home/ubuntu/pids/unicorn.pid"
if [ -f $file ];
then
echo "File found:"
ls /home/ubuntu/pids/
rm ~/pids/unicorn.pid
echo "unicorn.pid removed"
ls /home/ubuntu/pids/ #cross-checking the removal of the unicorn.pid
echo "if you see \"unicorn.pid removed\" message just above this line, it means unicorn.pid removed successfully"
else
echo "$file not found"
fi
RAILS_ENV=qa bundle exec unicorn -c config/unicorn.rb -D #this command is giving error "[stderr]master failed to start, check stderr log for details" `
非常感谢任何帮助。
标准错误日志
我,[2017-02-22T14:44:12.773724 #12531] INFO -- : 刷新宝石列表
E, [2017-02-22T14:44:21.233361 #12531] 错误 -- : 添加监听失败 addr=/home/ubuntu/unicorn.sock (in use)
E,[2017-02-22T14:44:21.233422 #12531] 错误 -- : 0.5 秒后重试(还剩 4 次尝试)
E, [2017-02-22T14:44:21.733925 #12531] 错误 -- : 添加监听失败 addr=/home/ubuntu/unicorn.sock (in use) E, [2017-02-22T14:44:21.734008 #12531 ] 错误 -- : 在 0.5 秒内重试(还剩 3 次尝试)
E, [2017-02-22T14:44:22.234528 #12531] 错误 -- : 添加监听失败 addr=/home/ubuntu/unicorn.sock (in use)
E,[2017-02-22T14:44:22.234626 #12531] 错误 -- : 在 0.5 秒内重试(还剩 2 次尝试)
E, [2017-02-22T14:44:22.735121 #12531] 错误 -- : 添加监听失败 addr=/home/ubuntu/unicorn.sock (in use)
E, [2017-02-22T14:44:22.738710 #12531] 错误 -- : 在 0.5 秒内重试(还剩 1 次尝试) E, [2017-02-22T14:44:23.239213 #12531] 错误 -- : 添加监听失败addr=/home/ubuntu/unicorn.sock (in use) E, [2017-02-22T14:44:23.239293 #12531] 错误 -- : 在 0.5 秒内重试(0 次尝试)
E, [2017-02-22T14:44:23.739818 #12531] 错误 -- : 添加监听失败 addr=/home/ubuntu/unicorn.sock (in use)
Errno::EADDRINUSE:地址已在使用中 - /home/ubuntu/unicorn.sock 的连接(2)“
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:158:in `initialize'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:158:in `new'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:158:in `bind_listen'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:242:in `listen'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `block in bind_new_listeners!'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `each'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `bind_new_listeners!'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:138:in `start'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/gems/unicorn-4.9.0/bin/unicorn:126:in `'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/bin/unicorn:22:in `load'
/home/ubuntu/ZenSol/curr/vendor/bundle/ruby/2.1.0/bin/unicorn:22:in `' ubuntu@ip-10-0-0-193:~/log$