I want to use Redis on Heroku but I got this error Redis::CannotConnectError (Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED))
.
I checked these , but didn't get helped. Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED, deploying redis to heroku unable to connect, How to get Redis to start on Heroku? .
I use Ruby 2.0.0p247 and Rails4. I'm using puma.
I use RedisToGo(nano) and, in /config/initializers/redis.rb I write this.
uri = URI.parse(ENV["REDISTOGO_URL"] || "redis://localhost:6379/" )
$redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
I checked "REDISTOGO_URL" is the same URL that I can see when $ heroku config
.
I did Redis restart on Heroku GUI, but it doesn't work.
Please tell me anything I need to do. Thank you for your help.