0
0
Redisquery~5 mins

Sentinel quorum concept in Redis

Choose your learning style9 modes available
Introduction

Sentinel quorum helps decide when to switch to a backup server if the main one stops working. It makes sure the decision is safe and agreed by enough helpers.

When you want your Redis system to keep working even if the main server fails.
When you have multiple Sentinel instances watching your Redis servers.
When you want to avoid wrong failover decisions by requiring agreement from several Sentinels.
When you want automatic recovery without manual intervention.
When you want to keep your data available and avoid downtime.
Syntax
Redis
sentinel monitor <master-name> <ip> <port> <quorum>

master-name is the name you give to your main Redis server.

quorum is the number of Sentinels that must agree a master is down before failover.

Examples
This sets up a Sentinel to watch a master named 'mymaster' on localhost port 6379, requiring 2 Sentinels to agree before failover.
Redis
sentinel monitor mymaster 127.0.0.1 6379 2
This configures Sentinel to monitor 'redis-master' at IP 192.168.1.10 port 6379, with a quorum of 3 Sentinels.
Redis
sentinel monitor redis-master 192.168.1.10 6379 3
Sample Program

This example sets up a Sentinel to watch a Redis master named 'mymaster' on localhost port 6379. It requires 2 Sentinels to agree before failover. It also sets the time to consider the master down and the failover timeout.

Redis
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel set mymaster down-after-milliseconds 5000
sentinel set mymaster failover-timeout 60000
OutputSuccess
Important Notes

The quorum number should be less than or equal to the total number of Sentinels monitoring the master.

If the quorum is too low, failover might happen too quickly and cause problems.

If the quorum is too high, failover might be delayed, causing downtime.

Summary

Sentinel quorum is the number of Sentinels that must agree a master is down before failover.

It helps keep your Redis system reliable and available.

Set quorum carefully based on how many Sentinels you have.