AWS redis connection error on my Kubernetes cluster

I want to use Redis on AWS. And my development env is depends on Skaffold with Kubernetes.

My security group configuration is:

Inbound rules

Outbound rules

And my Redis config like that:

Redis config

I want to connect this Redis on my nodeJS app from Kubernetes pods So, my code snipped like that:

let statsQueue = new Queue('statistics', '<Primary-Endpoint-On-AWS-Redis');

But I getting this error:

         triggerUncaughtException(err, true /* fromPromise */);
          ^

Error: connect EINVAL 0.0.24.235:6379 - Local (0.0.0.0:0)
    at internalConnect (node:net:909:16)
    at defaultTriggerAsyncIdScope (node:internal/async_hooks:431:12)
    at GetAddrInfoReqWrap.emitLookup [as callback] (node:net:1055:9)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:8) {
  errno: -22,
  code: 'EINVAL',
  syscall: 'connect',
  address: '0.0.24.235',
  port: 6379
}

Why I'm getting this error? How can ı solve this?

Upvotes: 0

Views: 733

Answers (1)

The error solved with adding Redis:// from URL.

So connection like that: let statsQueue = new Queue('statistics', 'Redis://<Primary-Endpoint-On-AWS-Redis');

Upvotes: 1

Related Questions