-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Today it's common that managed Redis Cluster expose a load balancer as main connection point that randomly forward requests to real Redis node. Popular ones are Azure Redis Cache and AWS ElasticCache. When Lettuce load topology view by calling CLUSTER NODES, the node with tag SELF will be replaced with load balancer URL.
Lettuce Version: 4.4.0.Final
This leads to 2 problems:
-
Load Balancer is considered as a normal node with slots assigned, but it forward requests randomly. So we will get randomly 'MOVED' response when request is forwarded into certain node.
-
When we try to connect the node being replaced and cluster node membership verification enabled(default), RedisException with message
This connection point is not known in the cluster viewwill be thrown. -
The symptom cannot be stably reproduced since we rely on
PartitionsConsensus.HEALTHY_MAJORITYto randomly return topology view. Only the view containing replaced self node the issue could be reproduced.
I believe this is same as #312, but the fix is not working. The root cause is inside NodeTopologyView# Constructor()
NodeTopologyView(RedisURI redisURI, String clusterNodes, String clientList, long latency) {
this.available = true;
this.redisURI = redisURI;
this.partitions = ClusterPartitionParser.parse(clusterNodes);
this.connectedClients = getClients(clientList);
this.clusterNodes = clusterNodes;
this.clientList = clientList;
this.latency = latency;
getOwnPartition().setUri(redisURI); // Updated self mode to RedisURL
}@mp911de I don't think simply removing this line is a good fix. I want to understand the motivation behind replacing ip and port with RedisURL. After that, I'm happy to provide a pull request to fix this.