【问题标题】:Remote Redis Server from Resque StandaloneResque Standalone 的远程 Redis 服务器
【发布时间】:2015-02-25 21:30:56
【问题描述】:

我想在不同的服务器上运行 Resque 工作程序,从一个 Redis 服务器获取作业。我知道如何在 Rails 应用程序中配置它,但问题是我在每台服务器上都使用独立的 Resque (https://github.com/dcestari/resque-standalone-sample)。

所以我的问题是,如何在不安装 Rails 应用程序的情况下做到这一点,这可能吗?

谢谢!

【问题讨论】:

  • 另外,对于以前从未接受过答案的用户来说,回答问题有点让人望而却步,当他们回答正确时,你真的应该接受他们。

标签: ruby redis resque worker


【解决方案1】:

您需要告诉 Resque Redis 的位置:

Resque.configure do |config|

  # Set the redis connection. Takes any of:
  #   String - a redis url string (e.g., 'redis://host:port')
  #   String - 'hostname:port[:db][/namespace]'
  #   Redis - a redis connection that will be namespaced :resque
  #   Redis::Namespace - a namespaced redis connection that will be used as-is
  #   Redis::Distributed - a distributed redis connection that will be used as-is
  #   Hash - a redis connection hash (e.g. {:host => 'localhost', :port => 6379, :db => 0})
  config.redis = 'redis://someserverip:port:db/namespace'

end

【讨论】:

  • 我需要在哪个文件中写入?它适用于独立的 resque 吗?
  • 如果您愿意,您可以在一个文件中完成所有这些操作。这不是你所说的轨道,所以“它去哪里”并不那么重要。
  • 当我尝试写它时,例如从github.com/dcestari/resque-standalone-sample 到 multiplier.rb,它不起作用。还是我真的需要创建一个配置文件?
猜你喜欢
  • 1970-01-01
  • 2013-05-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-02
  • 2021-10-03
  • 2021-04-06
  • 1970-01-01
相关资源
最近更新 更多