3

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?

4

1 回答 1

0

我今天发现的这种错误与 ioredis 无关,而是与 redis 实例设置有关。就我而言,我使用 ioredis 的 p3x-redis-ui 遇到的问题是集群未初始化。请参阅https://github.com/patrikx3/redis-ui/issues/48 ,也许您会找到任何线索来帮助您解决错误。

于 2020-12-11T15:15:11.340 回答