管理 Resque 和 Redis 的多个实例

发布于 2025-01-06 03:05:38 字数 568 浏览 3 评论 0原文

我试图让上帝监视 Resque 的两个实例,一个用于生产,一个用于登台。

因此,我在系统启动时启动两个 Redis 实例:redis_6379 和 redis_6380。

然后我使用Daemontools来启动和监控God。

我的上帝脚本看起来像这样:

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 实例关联起来吗?

我正在逐渐将其拼凑起来,但我认为我遗漏了一个关键部分。

提前致谢

I am trying to have God monitor two instances of Resque, one for production and one for staging.

So I start two Redis instances on system boot: redis_6379 and redis_6380.

Then I'm using Daemontools to start and monitor God.

My God script looks something like this:

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

Don't I need to somehow associate the staging and production resque processes with particular redis instances?

I'm gradually piecing this together but I think I'm missing a key piece.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

被翻牌 2025-01-13 03:05:38

首先,您不需要在 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

First, you don't need to specify QUEUE and RAILS_ENV in w.start since you already specified them in a proper place, w.env.

Second, this script runs a single instance of resque in a rails_env environment (whatever its value is).

I suggest something like this:

%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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文