【问题标题】:Managing multiple instances of Resque and Redis管理多个 Resque 和 Redis 实例
【发布时间】:2012-02-14 17:48:52
【问题描述】:

我正试图让上帝监控两个 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 实例相关联吗?

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

提前致谢

【问题讨论】:

    标签: redis resque god


    【解决方案1】:

    首先,您无需在w.start 中指定QUEUERAILS_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
    end
    

    【讨论】:

      猜你喜欢
      • 2014-09-25
      • 2012-05-25
      • 1970-01-01
      • 2014-06-06
      • 2021-08-15
      • 2011-06-12
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      相关资源
      最近更新 更多