Reputation: 8730
config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|
config.redis = { :url => 'redis://192.xxx.xxx.xx:6379/0' }
end
In production console when I do
ActivationWorker.perform_async(877459)
It gives an error
Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
Even sidekiq.log prints
Booting Sidekiq 5.1.3 with redis options {:url=>"redis://192.xxx.xxx.xx:6379/0", :id=>"Sidekiq-server-PID-646"}
Upvotes: 3
Views: 5565
Reputation: 1385
Based on the comments, we know that Redis is on a separate server.
Create a file in initializers: config/initializers/sidekiq.rb
:
Sidekiq.configure_server do |config|
config.redis = {
url: "redis://192.xxx.xxx.xxx:6379/12"
}
end
Sidekiq.configure_client do |config|
config.redis = {
url: "redis://192.xxx.xxx.xxx:6379/12"
}
end
/etc/redis/redis.conf
bind 192.xxx.xxx.xxx
redis
Upvotes: 0
Reputation: 4222
It is important to note that to configure the location of Redis, you must define both the Sidekiq.configure_server and Sidekiq.configure_client blocks
So also add to your config/initializers/sidekiq.rb
:
Sidekiq.configure_client do |config|
config.redis = { :url => 'redis://192.xxx.xxx.xx:6379/0' }
end
Also important notes from docs:
NOTE: The configuration hash must have symbolized keys.
NOTE: Unknown parameters are passed to the underlying Redis client so any parameters supported by the driver can go in the Hash.
Upvotes: 2