1

我试图让上帝监视两个 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

我不需要以某种方式将登台和生产 resque 过程与特定的 redis 实例相关联吗?

我正在逐渐将这些拼凑起来,但我认为我错过了一个关键部分。

提前致谢

4

1 回答 1

2

首先,您不需要指定QUEUEand RAILS_ENVinw.start因为您已经在适当的位置指定了它们,w.env.

其次,此脚本在环境中运行单个 resque 实例rails_env(无论其值是什么)。

我建议这样的事情:

%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
end
于 2012-02-14T17:52:29.093 回答