High availability with Redis Sentinel (master + replicas + 3 Sentinels)
RedisLevel: IntermediateDuration: 45–60 minBuilds a three-server Redis 7.2 / 8.2 or Valkey high-availability setup from scratch: one master, two replicas and one Sentinel on each server. maxmemory sized from RAM, persistence (RDB/AOF), password, kernel settings, quorum and timeouts, a planned failover test and a Sentinel-aware client connection are set up step by step; the result is a password-protected deployment that elects a new master on its own within seconds when the master goes down. If the data does not fit in a single server's memory or the write load exceeds a single master, open the Redis Cluster guide; day-to-day operation, backup and hardening of the deployed setup are covered in separate Redis guides.
Topology: 3 servers: Redis (1 master + 2 replicas) and Sentinel on each
Before you start
- All servers run the same operating system version and are up to date; time is synchronized with NTP (chrony).
- RAM matches the value in the form; swap is small but configured (against OOM during fork). At least twice the RAM is free on disk (for RDB/AOF rewrites).
- The servers can reach each other by IP (the Redis configuration uses IPs).
- Ports … and … are open between the servers; these ports are not used by another service.
- ……The servers can reach the operating system's AppStream repository (or EPEL)…The servers can reach the rpms.remirepo.net and EPEL (dl.fedoraproject.org) repositories………The servers can reach the Ubuntu universe repository…The servers can reach the packages.redis.io repository……, or an internal mirror is configured.
- There is no other Redis/Valkey installation on the servers (version conflict).
- You are logged in as root or with sudo rights; the maintenance window is approved.
Phases of the guide
- Operating system preparation (all servers) — Hostname: … · System update and tools · Kernel settings (sysctl) · Apply the sysctl settings
- Installation (all servers) — Add the Remi and EPEL repositories · Add the packages.redis.io repository · Install the … software
- Redis configuration — …: … · Set the password · Start Redis · Open the ports in the firewall · Verify replication
- Sentinel configuration — …: … · Set the Sentinel passwords · Start Sentinel · Verify that the Sentinels have discovered each other
- Failover test — Planned failover (SENTINEL FAILOVER) · Check the roles on all servers · Application connection
- Post-installation — Backup · Monitoring · Security recommendations