我正在尝试让上帝监控Resque的两个实例,一个用于生产,另一个用于测试。
因此,我在系统引导时启动了两个Redis实例: redis_6379和redis_6380。
然后我使用Daemontools来启动和监控上帝。
我的上帝脚本看起来像这样:
God.watch do |w|
w.dir = "#{rails_root}"
w.name = "resque-#{num}"
w.group = 'resque'
w.interval = 30.seconds
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
w.start = "rake resque:work QUEUE='*' RAILS_ENV=#{rails_env}"
....
end难道我不需要以某种方式将暂存和生产重新排队过程与特定的redis实例相关联吗?
我逐渐将这些拼凑在一起,但我认为我遗漏了一个关键部分。
提前感谢
发布于 2012-02-15 01:52:29
首先,您不需要在w.start中指定QUEUE和RAILS_ENV,因为您已经在适当的位置w.env中指定了它们。
其次,此脚本在rails_env环境中运行resque的单个实例(无论它的值是什么)。
我建议这样做:
%w(staging production).each do |rails_env|
God.watch do |w|
w.dir = "#{rails_root}" # <= is this path the same for production and staging?
# if not, change accordingly.
w.name = "resque-#{rails_env}"
w.group = 'resque'
w.interval = 30.seconds
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
w.start = "rake resque:work"
....
end
endhttps://stackoverflow.com/questions/9281710
复制相似问题