0
0
Redisquery~5 mins

Multiple Sentinel instances in Redis

Choose your learning style9 modes available
Introduction

Multiple Sentinel instances help keep your Redis system safe and working well by watching over your Redis servers together.

You want to make sure your Redis server keeps running even if one Sentinel stops working.
You need automatic switching to a backup Redis server if the main one fails.
You want to avoid mistakes by having several Sentinels agree before changing anything.
You want to monitor Redis servers from different places for better safety.
You want to balance the work of checking Redis servers among several Sentinels.
Syntax
Redis
sentinel monitor <master-name> <ip> <port> <quorum>

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

quorum is how many Sentinels must agree before taking action.

Examples
This sets up a Sentinel to watch a Redis server named 'mymaster' at IP 127.0.0.1 and port 6379, needing 2 Sentinels to agree to failover.
Redis
sentinel monitor mymaster 127.0.0.1 6379 2
This configures a Sentinel to monitor a Redis server at IP 192.168.1.10 with a quorum of 3 Sentinels.
Redis
sentinel monitor mymaster 192.168.1.10 6379 3
Sample Program

This example shows three Sentinel instances all set to watch the same Redis master named 'mymaster' on localhost port 6379. They require at least 2 Sentinels to agree before failover.

Redis
# Start three Sentinel instances monitoring the same master
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel monitor mymaster 127.0.0.1 6380 2
sentinel monitor mymaster 127.0.0.1 6381 2
OutputSuccess
Important Notes

Run multiple Sentinel instances on different servers or ports to avoid a single point of failure.

All Sentinels must have the same configuration for the master they monitor.

The quorum number should be less than or equal to the number of Sentinel instances running.

Summary

Multiple Sentinel instances work together to keep Redis safe and available.

They watch the same Redis master and agree before switching to a backup.

Use a quorum to decide how many Sentinels must agree to act.