how to connect to redis cluster using multiple node connection string?

Viewed 360

I am trying following code but not working. Getting error

[ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.

const Redis = require("ioredis");
const cluster = new Redis.Cluster([
    {
      port: 6379,
      host: "172.x.x.x",
    },
    {
      port: 6379,
      host: "172.x.x.x",
    },
    {
      port: 6379,
      host: "172.x.x.x",
    },
  ], {
  redisOptions: {
    password: "ssffvggfg",
  },
});

 cluster.set("foo", "bar");
 cluster.get("foo", (err, res) => {
  console.log(res);
 });

Thanks

0 Answers
Related