Redis Sentinel

Dec 20, 2018

Let's see a simple example with 3 servers. each server has 1 redis process, one of them is the master, the rest are slave, they work like this now:

graph LR a[Master] b[Slave1] c[Slave2] a -->|copy| b a -->|copy| c

we can write to master, read from both master and slave. all things are good as long as the master is never down.

well, you know it's impossible :)

that's why we need to use redis sentinel. deploy sentinel on each server to monitor each redis process.

graph LR a[Master] b[Slave1] c[Slave2] d[Sentinel1] e[Sentinel2] f[Sentinel3] d -->|watch| a e -->|watch| b f -->|watch| c

we can write & read with sentinel cluster instead of redis cluster now. sentinel handles all requests and pass them to redis. if redis master is down, sentinels vote a slave as the new master.