3
votes

I am currently trying to connect to my Redis cluster stored on another instance from a server running my application. I am using IoRedis to interface between my application and my Redis instance and it worked fine when there was only a single Redis node running. However, after trying to setup the cluster connection in my Node application, it constantly loops on the connection. My cluster setup works correctly.

As of now, I have tried the following configuration in my application to connect to the cluster. The issue is that the 'connect' even constantly loops printing out 'Connected to Redis!'. The events for 'ready' and 'error' are never fired.

const cache: Cluster = new Cluster([{
   port: 8000,
   host: REDIS_HOST
}, {
   port: 8001,
   host: REDIS_HOST
}, {
   port: 8002,
   host: REDIS_HOST
}]);

cache.on('connect', () => {
    console.log('Connected to Redis!');
});

In the end, the 'connect' event should only fire once. Does anyone have any thoughts on this?

1
Same issue for me. Did you ever figure this out @serbis? - rjhilgefort
Unfortunately not. The option that worked was to not run Redis in cluster mode and use a single instance of it on a single machine. - serbis
Thanks for the reply! - rjhilgefort
same problem using p3x-redis-ui on kubernetes, working on it currently at github.com/patrikx3/redis-ui/issues/48 - DevTheJo

1 Answers

0
votes

This kind of error, as I discovered it today, is not related to ioredis but to the redis instance setup. In my case, the problem I had with p3x-redis-ui, which use ioredis, it was the cluster that was not initialized. See https://github.com/patrikx3/redis-ui/issues/48 maybe you'll find any clues to help you resolve your bug.