-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
I'm not sure whether this is a bug or not. I have spun up a docker Redis cluster (No TLS) in my local Docker environment. I'm trying to connect to the cluster with the following configurations in my Node application (another container). But, what I can see in my node application logs is,
"Redis Cluster Error Error: connect ECONNREFUSED 127.0.0.1:6379".
It seems this library is trying to connect to the localhost. But I have tried with a different library and it worked for the Redis Clustor.
Here are my configs.
const cluster = createCluster({
rootNodes: [
{ url: 'redis://173.18.0.2:6379' },
{ url: 'redis://173.18.0.3:6379' },
{ url: 'redis://173.18.0.4:6379' }
],
nodeAddressMap: {
'redis://173.18.0.2:6379': { host: 'redis_1', port: 6379 },
'redis://173.18.0.3:6379': { host: 'redis_2', port: 6379 },
'redis://173.18.0.4:6379': { host: 'redis_3', port: 6379 }
},
defaults: {
socket: {
host: 'redis',
connectTimeout: 5000,
tls: false
},
password: ''
},
useReplicas: true
});
Am I missing any config here? Why does it try to connect to localhost?