Skip to content

When TLS is not enabled, library tying to connect to local host #2114

@tudugampala

Description

@tudugampala

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions