Hi,
I’m experiencing some connection issues with RedisCluster.
- I’m using Redis version 7.0 and connecting to RedisCluster with the ioredis package in a Node.js environment.
- In my development environment, I notice frequent connection closures. I suspect this is due to inactivity, so I’ve set keepAlive to 600000.
- In production, some pods occasionally encounter this error:
“WRONGPASS invalid username-password pair or user is disabled.” - Additionally, in Cloud Functions, some instances report this error:
“[ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.”
Do you think the issue could be related to the Redis-Cluster configuration? Any suggestions on how to resolve this?
Thanks
code implementation-
new Redis.Cluster(hosts, {
scaleReads: 'all', // Send write queries to masters and read queries to masters or slaves randomly.
redisOptions: {
password: token,
keepAlive: 600000, // 10 min in milliseconds
reconnectOnError: (err) => {
console.error('Reconnect on error:', err);
return true;
},
maxRetriesPerRequest: null // Infinite retries for requests let commands wait forever until the connection is alive again.
},
slotsRefreshTimeout: 5000,
clusterRetryStrategy: (times) => this.exponentialBackoffWithJitter(times)
})