0

Hi I am trying to connect Redis cluster using ioredis node module, my app is getting started and there is no connection error but my data is not published to Redis channel. Below is the code snippet of connection

    var redis = require("ioredis")
    publisher = new redis.Cluster(redisPort,redisHost);
    publisher.publish(channel, data);

what am i doing wrong here?

Anand Jain
  • 603
  • 7
  • 20

1 Answers1

1

you have forgotten the necessary brackets and "port", "host" attributes in the connection statement. Please add them as below.

var redis = require("ioredis")
publisher = new redis.Cluster([{port: option.redisPort,
                              host: option.redisHost}]);    
publisher.publish(channel, data);

You can refer "Cluster" section in following link for more information - https://www.npmjs.com/package/ioredis

Pratisha Paul
  • 91
  • 1
  • 5