title: ReplyError: MOVED error after connecting to Redis Cluster AWS
body: <p>I am building a nodejs app that connects to redis. I have this working with my local instance of redis. Now, I am using <code>ioredis</code> to connect from my nodejs app to my redis cluster in k8s in AWS.  Here is what I have.</p>
  <pre class="lang-js prettyprint-override"><code>const Redis = require(&quot;ioredis&quot;);
  
  this.redis = new Redis({
   port: 6379, // Redis port
   host: rhost, // Redis host
   password: password
  });
  
  this.redis.on('connect', () =&gt; {
   console.log('connected to redis')
  })
  </code></pre>
  <p>It seems like I successfully connect to my cluster as the message <code>connected to redis</code> prints out in the log. However, every time I try to use my redis object I get a MOVED error:</p>
  <pre><code>UnhandledPromiseRejectionWarning: ReplyError: MOVED 5011 &lt;ip address&gt;:6379
    at parseError (/node_modules/ioredis/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/node_modules/ioredis/node_modules/redis-parser/lib/parser.js:302:14)
  </code></pre>
  <p>The connection works on my local. However, in AWS it does not. I tried swapping using the <code>Redis.Cluster</code> object instead of <code>Redis</code>, but after I deploy the app, the application hangs and the connection event never fires. The <code>close</code> and <code>reconnecting</code> events seem to be looping infinitely.</p>
  <p>From my understanding, this is a problem with redirecting between nodes in the cluster. Perhaps it's a problem with the master/slave configuration. Is the error a configuration issue in AWS? Do I need to use the <code>Redis.Cluster</code> object instead of the plain <code>Redis</code> instance? What is the best way to fix the MOVED error?</p>