Sidekiq无法使用正确的redis选项启动

时间:2015-02-04 17:01:25

标签: ruby-on-rails ruby-on-rails-4 sidekiq

我需要在托管多个不同Rails应用程序的计算机上运行Sidekiq的多个实例。为了避免冲突,我让我的一个应用程序使用不同的redis实例,使用我config/initializers/sidekiq.rb中的以下代码

Sidekiq.configure_client do |config|
  config.redis = { :url => 'redis://127.0.0.1:6379/1' }
end

当我使用bundle exec sidekiq启动Sidekiq实例时,我收到以下启动消息:

2015-02-04T16:46:59.494Z 15104 TID-ovz94l9m0 INFO: Running in ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
2015-02-04T16:46:59.494Z 15104 TID-ovz94l9m0 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2015-02-04T16:46:59.494Z 15104 TID-ovz94l9m0 INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org/pro
2015-02-04T16:46:59.494Z 15104 TID-ovz94l9m0 INFO: Starting processing, hit Ctrl-C to stop
2015-02-04T16:46:59.541Z 15104 TID-ovz9c4dhk INFO: Booting Sidekiq 3.3.0 with redis options {}

问题在于我想要

2015-02-04T16:46:59.541Z 15104 TID-ovz9c4dhk INFO: Booting Sidekiq 3.3.0 with redis options {:url => 'redis://127.0.0.1:6379/1'}

代替。我应该编辑哪些命令行选项来启动Sidekiq或者我应该编辑哪些配置文件以使用config/initializers/sidekiq.rb中反映的redis选项启动Sidekiq?

1 个答案:

答案 0 :(得分:3)

您必须在configure_clientconfigure_server块中设置Redis配置。您正在启动服务器。更多信息:

https://github.com/mperham/sidekiq/wiki/Using-Redis