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