ioredis icon indicating copy to clipboard operation
ioredis copied to clipboard

local cannot connect remote redis server?

Open mowatermelon opened this issue 3 years ago • 8 comments

ioredis: 4.27.3

I config remote aliyun redis server address in config.local.ts, but it's not work.

// /src/config/config.local.ts
  config.redis = {
    port: 6379, // Redis port
    host: 'xxx.redis.rds.aliyuncs.com', // Redis host
    family: 4, // 4 (IPv4) or 6 (IPv6)
    db: 0,
  }

Terminal get a lot of connect 127.0.0.1:6379 error, how can i connent remote address in local?

[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

image

mowatermelon avatar Jul 12 '21 09:07 mowatermelon

Did you find any solution for this?

pdecarcer avatar Oct 29 '21 12:10 pdecarcer

I have the same. does anyone know the solution? I setup remote config but data was still taken from localhost

lyudad avatar Jun 22 '22 21:06 lyudad

same problem here

JonasRothmann avatar Aug 08 '22 08:08 JonasRothmann

I think a common issue is that you may not pass the options to ioredis. Maybe the options were in a deeper level or something. It's hard to say without a reproducible example.

luin avatar Aug 08 '22 09:08 luin

I think a common issue is that you may not pass the options to ioredis. Maybe the options were in a deeper level or something. It's hard to say without a reproducible example.

Any time I run ioredis I log the parameters and they are correct, but my application works despite this error message so I am not super personally invested in a fix. Maybe it is related to retryStrategy not certain.

JonasRothmann avatar Aug 08 '22 09:08 JonasRothmann

I think a common issue is that you may not pass the options to ioredis. Maybe the options were in a deeper level or something. It's hard to say without a reproducible example.

Any time I run ioredis I log the parameters and they are correct, but my application works despite this error message so I am not super personally invested in a fix. Maybe it is related to retryStrategy not certain.

From my experience, a possibility is there are multiple ioredis instances in your app and one was set up correctly whereas others were not.

luin avatar Aug 08 '22 09:08 luin

I think a common issue is that you may not pass the options to ioredis. Maybe the options were in a deeper level or something. It's hard to say without a reproducible example.

Any time I run ioredis I log the parameters and they are correct, but my application works despite this error message so I am not super personally invested in a fix. Maybe it is related to retryStrategy not certain.

From my experience, a possibility is there are multiple ioredis instances in your app and one was set up correctly whereas others were not.

I am running a cluster, so there are 5 connected as publishers and 1 as publisher and subscriber - they are all loaded with the right parameters though.

JonasRothmann avatar Aug 08 '22 09:08 JonasRothmann

I think a common issue is that you may not pass the options to ioredis. Maybe the options were in a deeper level or something. It's hard to say without a reproducible example.

Any time I run ioredis I log the parameters and they are correct, but my application works despite this error message so I am not super personally invested in a fix. Maybe it is related to retryStrategy not certain.

From my experience, a possibility is there are multiple ioredis instances in your app and one was set up correctly whereas others were not.

I am running a cluster, so there are 5 connected as publishers and 1 as publisher and subscriber - they are all loaded with the right parameters though.

Yeah when i remove that code it works. I am moving to a diff solution soon so its not too big of a deal, but heads up for anyone using node cluster in the future

JonasRothmann avatar Aug 21 '22 08:08 JonasRothmann