简体   繁体   English

使用ruby 2.0.0和Rails 3.2.14的Unicorn热重启

[英]Unicorn hot restart with ruby 2.0.0 and Rails 3.2.14

I am running e-commerce ruby on rails application using Unicorn app server. 我正在使用Unicorn应用程序服务器在Rails应用程序上运行电子商务ruby。 The ruby version is 2.0.0 and the rails version is 3.2.14. ruby版本是2.0.0,rails版本是3.2.14。 I am running Nginx as web server. 我正在将Nginx作为Web服务器运行。 When ever I push the code to the server, I need to restart the unicorn app server, which is causing a blup/bleep in the website, I googled around for the solution but nothing seem to be working. 每当我将代码推送到服务器时,我都需要重新启动unicorn应用程序服务器,这会导致网站上的blup / bleep,我四处搜寻解决方案,但似乎没有任何效果。 I was using passenger before which was fine. 我以前坐过乘客,还好。

Is there any way to avoid blup's during restarting hence maintain zero downtime. 有什么方法可以避免重新启动过程中的blup,从而保持零停机时间。

If you send USR2 to the unicorn master, it will cause the unicorn workers to restart, and should cause a zero downtime restart. 如果将USR2发送给独角兽主服务器,这将导致独角兽工作人员重新启动,并应导致零停机时间重新启动。 Send the USR2 signal with: 通过以下方式发送USR2信号:

kill -s USR2 process-id-of-master-process

Replace the process-id-of-master-process with the numeric process id of the unicorn master (find it with ps agx | grep unicorn, or look in the pids folder for unicorn.pid 用unicorn主服务器的数字进程ID替换主进程的进程ID(用ps agx | grep unicorn查找它,或在pids文件夹中查找unicorn.pid

Note that if unicorn is running under Bundler, you will still need to do a cold restart whenever you change the Gemfile, in order for the new Gemfile to be picked up. 请注意,如果unicorn在Bundler下运行,则无论何时更改Gemfile,您都仍需要进行冷重启,以便提取新的Gemfile。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM