You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have a Redis MemoryDB cluster with 2 nodes in AWS and I'm trying to connect to it through createCluster, but the connection isn't established.
Here is how I try to connect:
The log connected to cluster... is never showed up.
If I add in the configuration of createCluster to the defaults option the master node endpoint like this:
rootNodes - "An array of root nodes that are part of the cluster, which will be used to get the cluster topology. Each element in the array is a client configuration object. There is no need to specify every node in the cluster, 3 should be enough to reliably connect and obtain the cluster configuration from the server"
defaults - "The default configuration values for every client in the cluster. Use this for example when specifying an ACL user to connect with"
node-specific properties should be listed in rootNodes, the rest in defaults
Also when I connect I sometimes get the error ReplyError: MOVED 12539 rediss://redis-region-0001-002.amazonaws.com:6379 and I cannot get the value from the key.
Same issue as @ellik95.
I'm trying to connect with a Redis cluster running on Kubernetes and the connection is always ReplyError: MOVED xxxx
In my case I have Load Balancer to connect with, so I'm using createClient rather than createCluster.
Connection through redis-client command line works fine, though.
Is there any specific configuration we have to do with createClient when using Load Balanced redis cluster?
Then in my logs I get 'connecting to redis' followed immediately by 'connected to redis', but the connection is only to the one redis server that's in the default. If I try to sample random keys 2/3rds of them return with something like MOVED 11388 redis-2-url.
@leibale you're a wizard! That did it, I'm getting successful cluster connections now. I thought that having rediss as the protocol would handle the tls-ing but I guess cluster mode handles things a little differently.
Has this ever been addressed? I can't go to production with MemoryDB if this isn't fixed, and the approaches noted here result in an infinite loop of trying connection to localhost.
I had issues with hanging at await redisClient.connect(). What worked for me is to remove useReplicas. Not sure if it was due to my Redis replicas being on port 6380 and my masters on 6379
Activity
leibale commentedon Dec 20, 2021
As described in the clustering guide:
rootNodes- "An array of root nodes that are part of the cluster, which will be used to get the cluster topology. Each element in the array is a client configuration object. There is no need to specify every node in the cluster, 3 should be enough to reliably connect and obtain the cluster configuration from the server"defaults- "The default configuration values for every client in the cluster. Use this for example when specifying an ACL user to connect with"node-specific properties should be listed in
rootNodes, the rest indefaultsellik95 commentedon Dec 21, 2021
I had tried this also and the same thing happened! Could you please reopen the issue?
leibale commentedon Dec 21, 2021
@ellik95 It didn't work even when the username & password are in the
defaultsobject? can you please share your code?ellik95 commentedon Dec 21, 2021
Yes, with this code:
it is not connected. Only if I add the url of the master node to the defaults options works. Like this:
And I was wondering why is this needed.
leibale commentedon Dec 21, 2021
ellik95 commentedon Jan 2, 2022
It's not working either and
tlsoption does not exist in typePartial<RedisClusterClientOptions>.leibale commentedon Jan 2, 2022
@ellik95
ellik95 commentedon Jan 2, 2022
Unfortunately it is not working either. Only with the below code is:
ellik95 commentedon Jan 21, 2022
Also when I connect I sometimes get the error
ReplyError: MOVED 12539 rediss://redis-region-0001-002.amazonaws.com:6379and I cannot get the value from the key.lohanbodevan commentedon Feb 10, 2022
Same issue as @ellik95.
I'm trying to connect with a Redis cluster running on Kubernetes and the connection is always
ReplyError: MOVED xxxxIn my case I have Load Balancer to connect with, so I'm using
createClientrather thancreateCluster.Connection through
redis-clientcommand line works fine, though.Is there any specific configuration we have to do with
createClientwhen using Load Balanced redis cluster?1 remaining item
leibale commentedon Feb 16, 2022
@acb this line should fix it
acb commentedon Feb 16, 2022
@leibale oh, awesome! Do you have any idea when that might be pushed out in a release?
leibale commentedon Feb 16, 2022
@acb Sunday/Monday :)
acb commentedon Feb 22, 2022
@leibale I just tried release 4.0.4 and unfortunately I'm still having the same problem. With the code
I see 'connecting to redis' in my logs but it seems to hang and never actually connects. If I update my defaults to be
Then in my logs I get 'connecting to redis' followed immediately by 'connected to redis', but the connection is only to the one redis server that's in the default. If I try to sample random keys 2/3rds of them return with something like
MOVED 11388 redis-2-url.leibale commentedon Feb 22, 2022
@acb try this
acb commentedon Feb 25, 2022
@leibale you're a wizard! That did it, I'm getting successful cluster connections now. I thought that having
redissas the protocol would handle the tls-ing but I guess cluster mode handles things a little differently.Thanks so much for the help!
killdash9 commentedon Mar 29, 2022
For me, I found both the :6379 and the extra s in rediss:// to be unnecessary. This worked:
nixRajan commentedon Jun 9, 2022
I am still getting the Error
MOVED 12218 ip:6379.Following is the code
I do get the output : "client connected" and "PONG".
But when i do
await client.get()orawait client.set()i get the MOVED error.nixRajan commentedon Jun 10, 2022
This is to way to connect for above issue.
nibblesnbits commentedon Aug 16, 2023
Has this ever been addressed? I can't go to production with MemoryDB if this isn't fixed, and the approaches noted here result in an infinite loop of trying connection to localhost.
leibale commentedon Aug 16, 2023
@nibblesnbits none of these worked for you?
#1782 (comment)
#1782 (comment)
wanna share some code?
nibblesnbits commentedon Aug 16, 2023
Well it looks like lack of sleep and attention to detail killed me. I missed that the call was
createCluster, notcreateClient. 🤦♂️But now I'm curious; is it more correct to use the cluster(s)' hostname, or the individual nodes? Seems logical that the latter is more correct.
timvi402 commentedon Feb 27, 2024
For anyone trying to connect to a MemoryDb cluster using TLS, this has proven to be the solution:
AFAIK you want to use the cluster hostname(cluster endpoint), especially for MemoryDb where you may add or delete nodes dynamically.
cb-rnag commentedon Mar 4, 2024
@killdash9 correct. Not sure what the implications are, but
redis://instead ofrediss://appears to work. Port seems unnecessary too.With those changes in mind, my code now becomes:
Example of
<shard #2, node #1 endpoint>huan086 commentedon Dec 19, 2025
I had issues with hanging at
await redisClient.connect(). What worked for me is to removeuseReplicas. Not sure if it was due to my Redis replicas being on port 6380 and my masters on 6379