title: Error connecting to Redis Server from Node.js on Amazon AWS EC2 server
body: <p>I am trying to run a node.js server and a Redis server on an Amazon AWS Ec2 micro instance . </p>
  
  <p>I have installed Redis Server and the redis-server command runs fine . </p>
  
  <p>I use '<a href="http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever" rel="nofollow">Forever</a>' to keep the Redis-Server running . And it works fine . </p>
  
  <p>But when I start my Node server , it fails to connect to the Redis-Server .</p>
  
  <p>It gives the following error - </p>
  
  <pre><code>Error Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 
  </code></pre>
  
  <p>Doing a 'Forever List' shows that the redis server is running fine .</p>
  
  <pre><code>info:   Forever processes running
  data:       uid  command script                         forever pid   logfile                        uptime          
  data:   [0] _pXw node    app.js                         26670   26671 /home/ubuntu/.forever/_pXw.log 0:0:0:13.463    
  data:   [1] ylT1 node    redis-server                   25013   26681 
  </code></pre>
  
  <p>I have verified that when the redis-server starts , it starts at 6379 port .</p>
  
  <p>Can anyone help me explain why this error is happening and how I fix this ?</p>
  
  <p>I use the following code to connect to Redis . I have the client libraries installed for Redis .</p>
  
  <pre><code>var redis = require("redis"),
          client = redis.createClient();
  </code></pre>
  
  <p>Everything runs fine when I run the code on my localhost .</p>