deploying redis to heroku unable to connect deploying redis to heroku unable to connect heroku heroku

deploying redis to heroku unable to connect


For my setup I have /config/initializers/redis.rb with these lines:

uri = URI.parse(ENV["REDISTOGO_URL"] || "redis://localhost:6379/" )REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)

My REDISTOGO_URL is defined in my heroku configuration. You should be able to validate that by typing:

heroku config --app my_app

You'll see in the output the value for REDISTOGO_URL

You should copy your REDISTOGO_URL directly from Redis To Go. You find it in by going to the instance in heroku and clicking on Add Ons -> Redis To Go.

Here are a couple pointers:

  1. Verify you have your REDIS_TO_GO URL in your heroku config from the command line like I've demonstrated above.
  2. Verify the REDIS_TO_GO URL is identical to the one assigned to that instance in the Add Ons -> Redis To Go config.


i fixed it. i can't believe it! my complete solution is

uri = URI.parse(ENV["REDISTOGO_URL"])REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)Resque.redis = REDIS

verbatim. it works without explicitly setting the url because i guess heroku tries to set it up for me already


I got the same thing, so, basically Sidekiq was not grabbing the REDISCLOUD_URL from vars, it was grabbing REDIS_PROVIDER.

heroku config:set REDIS_PROVIDER=REDISCLOUD_URL

It worked like a charm.