Hands-on task
Sentinel and a manual failover
A pair is running: a master on 6379 with data and a replica on 6380 replicating it. The master needs to go down for maintenance — switch the roles through Sentinel, so that clients asking it for the master address move to the new one.
- Configure Sentinel in
/etc/redis/sentinel.conf: port 26379, monitoring mastermymaster=127.0.0.1:6379with quorum 1 (we have a single Sentinel),down-after-millisecondsformymaster— no more than 10000. - Start Sentinel in the background and make sure it has found the replica.
- Perform a manual failover using Sentinel.
Result: Sentinel reports master 127.0.0.1:6380, instance 6380 is the master, the former master 6379 has become its replica, no data is lost. Don't switch the roles by hand with REPLICAOF — Sentinel must do it.
- redis
- Sentinel
- failover
- high availability
- replication
- quorum