0
0
Redisquery~5 mins

Monitoring with Sentinel in Redis

Choose your learning style9 modes available
Introduction

Sentinel helps watch over Redis servers to keep them running smoothly. It notices problems and can fix them automatically.

You want to make sure your Redis server is always available without manual checks.
You need automatic failover if the main Redis server stops working.
You want to monitor multiple Redis servers in a group.
You want alerts when Redis servers have issues.
You want to keep your Redis system stable and reliable.
Syntax
Redis
sentinel monitor <master-name> <ip> <port> <quorum>

master-name: A name you give to the main Redis server.

quorum: Number of Sentinels that must agree a master is down before action.

Examples
This tells Sentinel to watch a Redis server named 'mymaster' at IP 127.0.0.1 on port 6379. It needs 2 Sentinels to agree before failover.
Redis
sentinel monitor mymaster 127.0.0.1 6379 2
Sentinel watches 'redis-main' on IP 192.168.1.10 port 6380, requiring 3 Sentinels to agree on failure.
Redis
sentinel monitor redis-main 192.168.1.10 6380 3
Sample Program

This configuration sets up Sentinel to monitor a Redis master named 'mymaster' at localhost port 6379. It marks the master as down if no response in 5 seconds, sets failover timeout to 10 seconds, and allows one replica to sync in parallel during failover.

Redis
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 10000
sentinel parallel-syncs mymaster 1
OutputSuccess
Important Notes

Sentinel needs at least 3 instances running for reliable failover decisions.

Make sure all Sentinels have the same configuration for the monitored masters.

Sentinel automatically promotes a replica to master if the current master fails.

Summary

Sentinel watches Redis servers to detect failures automatically.

It can promote replicas to master to keep Redis available.

Use 'sentinel monitor' to tell Sentinel which Redis server to watch.