Redis cluster design

Hey everyone!

I have set up 3 Sentinel Redis servers where I have one main Redis instance and 2 secondary Redis instances. Sentinel enables Redis secondary instance to get promoted to main on when the main instance goes down. I have two questions around this setup:

  1. My application should always be communicating with the main instance right?
  2. All three Redis servers have different IP addresses. If my main redis server goes down, I will need to do several checks:
    a. The first one will acknowledge that the redis server is down and can’t process requests (i.e my request will fail)
    b. I will need to hit one of the other two servers to check which one is the main one.
    c. Send the request to the main redis instance
    Is there a simpler way around this?

According to the documentation you need to get the new leader address(, this doesn’t add much complexity since they expose an API to do so. If a write fails then you just call the “Get Master Addr By Name” API. Most clients available have sentinel support. For example:

Hope this helps

Hey !

Thanks for the reply.

Yeah, if a write fails, I need to call this API “Get Master Addr By Name” and for this I would need to ping one of the other servers. Once I get the the Address, I would then send the request to the Address. These are three network calls to the Redis cluster. Is there a simpler way?

You could load balance your reads across replicas with something like ‘’ and your writes with ‘’ where the load balancer is responsible for routing to the active leader. Sentinel can notify about problems with redis instances.
But if you want to talk directly with the cluster I think your only option is to query for the active leader either before you make a write request or after write failure and retry.

It seems like I would need to setup HAProxy

It depends on your environment, setting up proxy/LBs might be overkill, if you are running containers then an ambassador might be nice but could also be overkill as well, the simplest lowest effort would probably be a decorator for your write function if your Redis client doesn’t provide any leader discovery features.

I found something:

Maybe this could be of help. Let’s see.

Thanks for all your help!