title: Redis Cluster on AWS configuration on connect-redis and ioredis
body: <p>I have a Redis Cluster configured on AWS (ElastiCache).</p>
  
  <p>It has a configuration endpoint and 6 nodes (3 shards).</p>
  
  <p>When reading the documentation of the npm module <a href="https://github.com/tj/connect-redis" rel="nofollow noreferrer">here</a>, it says that you have to incorporate ioredis to get it to work for a Redis cluster.</p>
  
  <p>I shared the configuration below which works for a single Redis node but not for a cluster</p>
  
  <pre><code>"use strict";
  
  // Include modules
  var express = require("express"),
      cookieParser = require("cookie-parser"),
      bodyParser = require("body-parser"),
      session = require("express-session"),
      RedisStore = require("connect-redis")(session),
      middleware = require("./routes/middleware"),
  
      app = express(),
      sessionNameOfApp = createAppSpecificSession(configNameOfApp),
  
  //This works but only for a single node. It doesn't work for a Redis Cluster
  function createAppSpecificSession(config) {
      return session({
          store: new RedisStore({
              host: config.SESSION.host,
              port: config.SESSION.port,
              pass: config.SESSION.pass
          }),
          resave: false,
          saveUninitialized: false,
          secret: config.SESSION.cookieSecret,
          name: config.SESSION.cookieName,
          genid: sessionMethods.generateSessionId
      });
  }
  
  app.use(middleware.setUUIDOnReq);
  app.use(middleware.setAgentOnReq);
  
  // additional app modules
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({
      extended: false
  }));
  app.use(cookieParser());
  
  app.use(middleware.setSessionMethods);
  
  // Include routes
  require("./routes/app")(express, app);
  
  module.exports = app;
  </code></pre>
  
  <p>My question is - how do I incorporate ioredis to support clustering?</p>
  
  <p>This is a huge blocker for me so any help will be highly appreciated.</p>
  
  <p>Looked for an example all over the net and got nothing!</p>