node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

createCluster, port 6279 messing up hostname !!???

Open tamis-laan opened this issue 2 years ago • 2 comments

Given the code

const cluster = createCluster({
  rootNodes: [
    {
      url: 'redis://redis-1:6379'
    },
  ]
});

I get the following error:

Error: connect ECONNREFUSED 127.0.0.1:6379

The ip refers to localhost the correct ip for redis-1 should be 10.0.1.34.

If I change the default port in the code

const cluster = createCluster({
  rootNodes: [
    {
      url: 'redis://redis-1:1000'
    },
  ]
});

i get the error:

Error: connect ECONNREFUSED 10.0.1.34:1000

By changing the port from the default of 6379 to something else the hostname is resolved to the correct ip!?

I'm using client redis version 4.0.0 on node version 16.7 and redis server version 6.2.4. Everything is build in docker containers.

tamis-laan avatar Jun 22 '22 19:06 tamis-laan

Same issue here.

boxymoron avatar Aug 04 '22 18:08 boxymoron

See https://github.com/redis/node-redis/issues/2213#issuecomment-1194420312

leibale avatar Aug 04 '22 22:08 leibale

If it's still an issue feel free to reopen

leibale avatar Jan 29 '23 20:01 leibale

If it's still an issue feel free to reopen

I met the same error in createClient. Is there any solution?

passer-byzhang avatar Feb 16 '23 07:02 passer-byzhang