chr0nikler
chr0nikler

Reputation: 488

Heroku RedisCloud Redis::CannotConnectError on localhost instead of REDISCLOUD_URL

There are quite a few questions like this, but none seem to resolve my issue. Here's the grub:

Rails 4, Ruby 2.0.0 app using Resque and Redis.

My redis initializer:

#config/initializers/redis.rb
if ENV["REDISCLOUD_URL"]
    $redis = Redis.new(:url => ENV["REDISCLOUD_URL"])
end

Error is this, as reported by heroku logs:

Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED)

My procfile:

web: bundle exec rackup config.ru -p $PORT
resque: env TERM_CHILD=1 QUEUES=* bundle exec rake resque:work

If it helps, my REDISCLOUD_URL is:

redis://rediscloud:somestuff@someotherstuff:17695

It isn't in http://. Is that an issue?

I've tried all the other stack overflow posts on this issues, and nothing works. Any tips? I've been follwing the RedisCloud Heroku page here: https://devcenter.heroku.com/articles/rediscloud

Upvotes: 5

Views: 764

Answers (1)

chr0nikler
chr0nikler

Reputation: 488

Nevermind, I found the answer. I did $redis = Resque.redis = Redis.new ... in my redis.rb initializer, and then I had to migrate my db. Silly me.

Upvotes: 6

Related Questions