Search code examples
ruby-on-railsredissidekiq

Sidekiq cannot connect to Redis server


I try to apply sidekiq for my project on my MacOS. Firstly I try to start redis:

redis-server /usr/local/etc/redis.conf

After that, I start sidekiq:

bundle exec sidekiq

But I meet following exception:

getaddrinfo: nodename nor servname provided, or not known

It looks like that sidekiq cannot connect to redis server. Here is my project configuration for sidekiq:

Sidekiq.configure_server do |config|
  config.redis = { url: 'redis://redis:6379' }
end

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

Sidekiq.default_worker_options = {
  retry: false
}

But if I remove configuration in my rails project, sidekiq can connect to redis. So I think there is "something wrong" with above configuration.

Please help me which part have I wrong.


Solution

  • It seems, that you provide wrong url to redis

    As far as I know, default url to redis is redis://localhost:6379, not redis://redis:6379. Please, try it out, it may help.