Cannot determine a partition for slot xyz #141
-
I am using Lettuce RedisClusterClient to connect to the docker container. Any query that I put in via lettuce client, I get the error I can do redis-cli though and
lettuce client code
I can connect to elastic cache cluster with this code though. Any idea what I may be missing here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
So in general this is probably a issue with the client code, so i should say that you should ask in the lettuce domain what the issue really is. But from experience i can most certainly say that your issue is one of the most common issues when running this container. When running redis in cluter mode, each server node inteenrally will keep this cluster slots mapping that tells each redis server how each server reaches all other nodes from their pov. not from the clients pov. So the issues occurs when in this docker container we run all 6 redis servers on the same machine because it usually wants to track each other node to 127.0.0.1 as that is the closest route to it's neighbors. The problem with that is when a client connects and asks for the current cluster state, it will get back "oh hey client, this cluster nodes is on 127.0.0.1:7000 and not on the external ip address ourside the docker container. This do not happen when you run on elastic cache as each redis server reaches each other node over the internet or within your vpc inside your cloud. In those cases clients and server nodes works with same IP. One simple solution might be just to run your docker container with host-network mode and ensure that each redis node uses 127.0.0.1 as the IP it tracks for each node. The downside for this is that you removes the possibility for reaching the redis servers from any other machine then localhost. This is by design with the purpose and use-case for this docker container. TLDR is to ensure the IP internally and externally is reachable from your clients. |
Beta Was this translation helpful? Give feedback.
So in general this is probably a issue with the client code, so i should say that you should ask in the lettuce domain what the issue really is.
But from experience i can most certainly say that your issue is one of the most common issues when running this container.
When running redis in cluter mode, each server node inteenrally will keep this cluster slots mapping that tells each redis server how each server reaches all other nodes from their pov. not from the clients pov. So the issues occurs when in this docker container we run all 6 redis servers on the same machine because it usually wants to track each other node to 127.0.0.1 as that is the closest route to it's neighbors. The prob…