LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

redis-sentinel

High availability monitoring for Redis clusters

TLDR

Start Sentinel
$ redis-sentinel [/etc/redis/sentinel.conf]
copy
Start with Redis server
$ redis-server [sentinel.conf] --sentinel
copy
Check Sentinel status
$ redis-cli -p [26379] sentinel masters
copy
Monitor master
$ redis-cli -p [26379] sentinel master [mymaster]
copy

SYNOPSIS

redis-sentinel configfile_

DESCRIPTION

Redis Sentinel provides high availability for Redis deployments through continuous monitoring, automatic failover, and notification. It watches master and replica instances, and when a master becomes unreachable and a quorum of Sentinel processes agrees it is down, it automatically promotes a replica to master and reconfigures the remaining replicas to use the new master.Sentinel also acts as a configuration provider, allowing clients to discover the current master address for a named service. Multiple Sentinel instances (at least three recommended) form a distributed system that reaches consensus on failover decisions, preventing split-brain scenarios.

EXAMPLES

$ # Start Sentinel
redis-sentinel /etc/redis/sentinel.conf

# Or via redis-server
redis-server sentinel.conf --sentinel

# Query masters
redis-cli -p 26379 sentinel masters

# Get master address
redis-cli -p 26379 sentinel get-master-addr-by-name mymaster

# List replicas
redis-cli -p 26379 sentinel replicas mymaster

# Failover manually
redis-cli -p 26379 sentinel failover mymaster
copy

CONFIGURATION

/etc/redis/sentinel.conf

Main Sentinel configuration file defining monitored masters, quorum thresholds, and failover parameters.
sentinel monitor name host port quorum
Define a master to monitor with the minimum number of Sentinels that must agree it is down before failover.
sentinel down-after-milliseconds name ms
Time in milliseconds a master must be unreachable before being considered down.
sentinel failover-timeout name ms
Maximum time for a failover operation to complete before being considered failed.

QUORUM

The number after master definition is quorum - minimum Sentinels agreeing master is down before failover.

CAVEATS

Need at least 3 Sentinels for robustness. Port 26379 default. Modifies config file on failover.

HISTORY

Redis Sentinel was introduced in Redis 2.8 by Salvatore Sanfilippo for Redis high availability.

SEE ALSO

Copied to clipboard
Kai