Redis Sentinel là hệ thống HA cho Redis single-master/replica setup — tự động monitor, notify và failover khi master fail.
- Sentinel chạy như separate process (thường 3+ Sentinel nodes để quorum). Chức năng: Monitoring — Sentinel liên tục ping master và replicas; Notification — alert qua pub/sub khi có vấn đề; Automatic failover — khi master down, Sentinel bầu (quorum majority) và promote replica thành master mới, cập nhật cấu hình các replica còn lại để follow master mới; Service discovery — client query Sentinel để lấy địa chỉ master hiện tại. Quorum: số Sentinel tối thiểu phải đồng ý master down để bắt đầu failover — tránh split-brain khi network partition.
- Setup tối thiểu: 3 Sentinel + 1 master + 1 replica. Khác với Cluster: Sentinel không sharding, không scale write horizontally — chỉ HA.
- Dùng Sentinel khi: cần HA nhưng data fit trong 1 server; dùng Cluster khi: cần scale beyond single server.
Redis Sentinel is an HA system for single-master/replica Redis setups — it automatically monitors, notifies, and performs failover when the master fails.
- Sentinel runs as a separate process (typically 3+ Sentinel nodes for quorum). Functions: Monitoring — Sentinel continuously pings the master and replicas; Notification — alerts via pub/sub when issues arise; Automatic failover — when the master goes down, Sentinels vote (quorum majority) to promote a replica to the new master and update remaining replicas to follow it; Service discovery — clients query Sentinel to discover the current master address. Quorum: the minimum number of Sentinels that must agree the master is down before initiating failover — prevents split-brain during network partitions.
- Minimum setup: 3 Sentinels + 1 master + 1 replica. Vs Cluster: Sentinel does not shard data or scale writes horizontally — HA only.
- Use Sentinel when: HA is needed but data fits on one server; use Cluster when: you need to scale beyond a single server.