Updated on 2024-07-29 GMT+08:00

What Is Sentinel?

Overview

High availability in Redis is implemented through Sentinel. Sentinel helps you defend against certain types of faults without manual intervention, and complete tasks such as monitoring, notification, and client configuration. For details, see the Redis official website.

Principles

Redis Sentinel is a distributed system where multiple Sentinel processes work together. It has the following advantages:

  1. Fault detection is performed only when multiple Sentinels agree that a master node is unavailable, which reduces the possibility of false positives.
  2. Even if some Sentinel processes are faulty, the Sentinel system can still work properly to prevent faults.

On a higher level, there is a larger distributed system consisting of Sentinels, Redis master and replica nodes, and clients connected to Sentinels and Redis.

Functions

  • Monitoring: Sentinel continuously checks whether the master and replica nodes are working properly.
  • Notification: If a node is faulty, Sentinel can notify the system administrator or other computer programs by calling an API.
  • Automatic failover: If the master node is abnormal, Sentinel starts a failover to promote a replica to master. Other replicas replicate data from the new master node. Applications that use the Redis instance will be notified that they should connect to the new address.
  • Client configuration: Sentinel serves as the authoritative source for client service discovery. Clients connect to Sentinel and requests the address of the master Redis node that is responsible for specific services. If a failover occurs, Sentinels delivers the new address.