Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 272
chr0nikler Avatar asked Sep 14 '15 03:09

chr0nikler


1 Answers

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.

like image 114
chr0nikler Avatar answered Nov 15 '22 00:11

chr0nikler