Capistrano在部署后无法重启Puma服务器

时间:2017-07-26 13:27:41

标签: ruby-on-rails ruby capistrano bundler puma

彪马:3.8.2
capistrano3-puma:3.1.1
Rails:5.0.1
Ruby:2.3.3

我的系统配置包含3台服务器,总共有一台或两台服务器,Puma在部署后不会重新启动。但是,部署日志显示为Command restart sent success

然后,我登录到所有服务器,并运行ps aux | grep puma。输出很奇怪。

服务器1: puma工作正常,10:06已成功重新启动20170726095950

deploy   21379  0.0  3.5 2119668 274772 ?      Sl   10:06   0:01 puma 3.8.2 (unix:///var/www/fbdash/shared/tmp/sockets/puma.sock) [20170726095950]                                                        
deploy   21384  0.7  8.0 2266296 618124 ?      Sl   10:06   0:35 puma: cluster worker 0: 21379 [20170726095950]                                                                                           
deploy   21387  0.9  7.9 2269380 607296 ?      Sl   10:06   0:46 puma: cluster worker 1: 21379 [20170726095950]                                                                                           
deploy   21390  1.0  7.4 2271436 569760 ?      Sl   10:06   0:48 puma: cluster worker 2: 21379 [20170726095950]                                                                                           
deploy   21394  0.8  7.8 2203948 603500 ?      Sl   10:06   0:41 puma: cluster worker 3: 21379 [20170726095950]                                                                                           
deploy   25204  0.0  0.0  10484  2260 pts/2    S+   11:26   0:00 grep --color=auto puma

服务器2:与服务器1相同,puma工作正常,在10:06成功重新启动,版本为20170726095950

deploy   21379  0.0  3.5 2119668 274772 ?      Sl   10:06   0:01 puma 3.8.2 (unix:///var/www/fbdash/shared/tmp/sockets/puma.sock) [20170726095950]                                                        
deploy   21384  0.7  8.0 2266296 618124 ?      Sl   10:06   0:35 puma: cluster worker 0: 21379 [20170726095950]                                                                                           
deploy   21387  0.9  7.9 2269380 607296 ?      Sl   10:06   0:46 puma: cluster worker 1: 21379 [20170726095950]                                                                                           
deploy   21390  1.0  7.4 2271436 569760 ?      Sl   10:06   0:48 puma: cluster worker 2: 21379 [20170726095950]                                                                                           
deploy   21394  0.8  7.8 2203948 603500 ?      Sl   10:06   0:41 puma: cluster worker 3: 21379 [20170726095950]                                                                                           
deploy   25204  0.0  0.0  10484  2260 pts/2    S+   11:26   0:00 grep --color=auto puma

服务器3:其中两个群集已停止(根本没有重启),仍然指向旧版本20170726080157

deploy   22364  0.0  3.6 2120888 279128 ?      Sl   09:37   0:00 puma 3.8.2 (unix:///var/www/fbdash/shared/tmp/sockets/puma.sock) [20170726080157]                                                                                                                             
deploy   22369  0.1  9.3 2405448 719184 ?      Sl   09:37   0:11 puma: cluster worker 0: 22364 [20170726080157]                                                                                                                                                                
deploy   22378  0.2 10.9 2538956 838948 ?      Sl   09:37   0:15 puma: cluster worker 3: 22364 [20170726080157]                                                                                                                                                                
deploy   30422  0.0  0.0  10484  2160 pts/2    S+   11:26   0:00 grep --color=auto puma

这导致所有定向到此服务器的请求超时,错误代码为HTTP 408。

我还尝试了cap production puma:stop,然后是cap production puma:start,但它仍然无效。我不得不使用kill -9 PIDs隐藏所有旧流程,然后发送cap production puma:start

所以,从技术上讲,

~/.rvm/bin/rvm default do bundle exec pumactl -S /var/www/fbdash/shared/tmp/pids/puma.state -F /var/www/fbdash/shared/puma.rb stop/restart

什么也没做。

知道为什么会这样吗?

我还发现Puma工作人员在重新启动时没有正常关闭。这导致旧进程仍在运行,并且新版本文件夹中的nginx侦听套接字(尚未启动)。

[24498] PumaWorkerKiller: Consuming 3081.06640625 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 3081.06640625 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 3081.06640625 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 3081.06640625 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 3081.06640625 mb with master and 4 workers.
[24498] - Gracefully shutting down workers...
[24498] PumaWorkerKiller: Consuming 1250.91796875 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 1250.91796875 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 1250.91796875 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 1250.91796875 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 1250.91796875 mb with master and 4 workers.
[24498] PumaWorkerKiller: Consuming 1250.91796875 mb with master and 4 workers.

请注意,它显示Gracefully shutting down workers但是,在下一行中,工作人员仍然继续使用旧的PID。

0 个答案:

没有答案