redishiredis

Client's interaction with Redis Cluster


I've started exploring Redis Cluster and it's C client(hiredis). I've been unable to find much info about the client's interaction with the Redis cluster. I've got some queries in this regard:


Solution

  • Does the client make a connection with all the nodes?

    Yes, the client maintains a connection with all the masters at least.

    Is there a coordinator node which proxies the client's request to the correct node?

    No, there isn't. By design, redis cluster does not have a proxy. (Aside: There is some talk of developing a proxy solution for redis - but I don't expect it to be released any time soon.)

    Does the client periodically get info about hash slot bindings?

    When a client starts up, it builds up a cache of hash-slot mappings. Then, at runtime, if a slot is migrated to another master, redis cluster will return a specific error that will tell the client the new owner for that slot. The client is then expected to cache the new owner, and retry the request against the new node.

    As a result of this design, clients usually have a very good cache of every slot and it's owner, and there is very little overhead.

    which client connection parameters are configurable?

    The most important parameter is the list of server nodes to connect to the cluster. You don't have to specify all the nodes - the client can auto-discover all the masters. As long as even one node is active, the client will discover all the other nodes.

    Apart from that, you have connection timeout parameters, parameters to control TLS.