Skip to content

Cluster topology lookup should not replaces self-node details with host and port from RedisURI when RedisURI is load balancer #712

@warrenzhu25

Description

@warrenzhu25

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:

  1. 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.

  2. 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 view will be thrown.

  3. The symptom cannot be stably reproduced since we rely on PartitionsConsensus.HEALTHY_MAJORITY to 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions