V
V
Viktor Login2014-10-14 21:47:20
Ruby on Rails
Viktor Login, 2014-10-14 21:47:20

How to connect redis cloud on heroku?

I don't understand how to connect redis to heroku.
I added the redis cloud addon to the application, added the following to redis.rb:

if ENV["REDISCLOUD_URL"]
  $redis = Redis.new(:url => ENV["REDISCLOUD_URL"])
else
  $redis = Redis.new(:host => 'localhost', :port => 6379)
end

Besides that, is there anything else I need to write? REDISCLOUD_URL explicitly set somewhere? In the console, when trying to interact with the database, it displays:
Errno::ECONNREFUSED: Connection refused - Unable to connect to Redis on 127.0.0.1:6379

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Luxurious, 2014-10-16
@BATAZOR

heroku login
heroku addons:add openredis
in project folder

@
@mgyk, 2014-10-19
_

heroku config
Do it first and see if that ENV variable is there. Are you trying to connect to localhost?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question