0
votes

on my docker server I've got error on sidekiq/redis URL URL sepcification:

Sidekiq.configure_client do |config| config.redis =  { url: "redis://bsc_redis:6379", size: 1 } end

I get

URI::InvalidURIError: the scheme redis does not accept registry part: bsc_redis:6379 (or bad hostname?) from /usr/local/lib/ruby/2.0.0/uri/generic.rb:214:in initialize' from /usr/local/lib/ruby/2.0.0/uri/common.rb:218:innew' from /usr/local/lib/ruby/2.0.0/uri/common.rb:218:in parse' from /usr/local/lib/ruby/2.0.0/uri/common.rb:747:inparse' from /usr/local/bundle/gems/sidekiq-4.2.9/lib/sidekiq/redis_connection.rb:86:in log_info' from /usr/local/bundle/gems/sidekiq-4.2.9/lib/sidekiq/redis_connection.rb:20:in create' from /usr/local/bundle/gems/sidekiq-4.2.9/lib/sidekiq.rb:131:in redis=' from (irb):4:inblock in irb_binding' from /usr/local/bundle/gems/sidekiq-4.2.9/lib/sidekiq.rb:83:in configure_client' from (irb):4 from /usr/local/bundle/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in start' from /usr/local/bundle/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in start' from /usr/local/bundle/gems/railties-3.2.13/lib/rails/commands.rb:41:in ' from script/rails:6:in require' from script/rails:6:in'

But it works, when I specifiy the IP address, of the bsc_redis container:

Sidekiq.configure_client do |config| config.redis =  { url: "redis://172.18.0.5:6379", size: 1 } end
=> {:url=>"redis://172.18.0.5:6379", :size=>1}

When I ping bsc_redis from the rails container, it responses from 172.18.0.5. I cannot find any problem, why this occures.

Any idea?

Thank you

2
Try this instead and see if it helps redis://bsc_redis:6379/0Tarun Lalwani
I've tried before, nothing changed @TarunLalwaniDavid
Then try this config.redis = { host: "bcs_redis", port: 6379, db: 0}Tarun Lalwani
oh, perfect thank you very much! can you send it as an answer, that I can confirm it?David

2 Answers

1
votes

Try using

config.redis = { url: "redis://bsc_redis:6379/0"}

or

config.redis = { host: "bcs_redis", port: 6379, db: 0}

Both are valid but i guess there might some issue because of docker based dns in first one which sidekiq is not handling well

0
votes

While on docker, only this worked for me

config.redis = { host: "bcs_redis", port: 6379, db: 0}