簡體   English   中英

如何在不殺死主進程的情況下重新加載Unicorn?

[英]How do I reload Unicorn without killing the master process?

我有一個RubyOnRails項目,並在Ubuntu服務器上將它與Unicorn一起部署在nginx上。

如果我更改其中一個配置文件,我需要重新啟動Unicorn,但是當我殺死Unicorn的主進程並使用bundle exec再次啟動時,它會關閉我的站點。

是否有任何方法可以讓Unicorn使用新文件而不會破壞進程並且不會崩潰?

在我的capistrano deploy.rb中我有:

desc "Zero-downtime restart of Unicorn"
task :restart, :except => { :no_release => true } do
  run "kill -s USR2 unicorn_pid"
end

這在“ 使用git,capistrano,nginx和Unicorn進行快速,零停機部署 ”中有詳細記載。

這兩個答案,包括被接受的答案都很糟糕。

http://unicorn.bogomips.org/SIGNALS.html表示將HUP發送到主進程。

desc "Zero-downtime restart of Unicorn"
task :restart, :except => { :no_release => true } do
  run "kill -s HUP `cat tmp/pids/unicorn.pid`"
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM