Skip to main content

How does Sentinel provide Redis's fault tolerance?

Redis Sentinel provides fault tolerance by continuously monitoring Redis nodes and automatically electing a new master on failure.

Here's how it works, step by step:

1. Monitoring

Every Sentinel tracks all the Redis nodes in the system:

  • it regularly pings (PING) the master and its replicas;
  • if the master doesn't respond within a set time (down-after-milliseconds), the Sentinel marks it as subjectively down (SDOWN), "as far as I can tell, it's dead".

2. Quorum (confirming the failure)

A single Sentinel can't declare the master "down" on its own. To avoid false positives, several Sentinels have to agree that the node is genuinely unreachable.

Once that agreement is reached, the master is marked objectively down (ODOWN), "objectively dead".

3. Automatic failover

Once the master is declared ODOWN:

  1. The Sentinels elect a new "leader" among themselves (via a Raft-like voting process).
  2. The leader picks one of the master's replicas and promotes it to the new master using the SLAVEOF NO ONE command.
  3. The remaining replicas reconfigure themselves to replicate from this new master.

4. Notifying clients

After the failover, Sentinel:

  • updates its configuration,
  • broadcasts notifications to clients over Pub/Sub channels (+switch-master),
  • Sentinel-aware clients automatically connect to the new master.

5. Recovering the old master

If the old master comes back:

  • it automatically becomes a replica of the new master,
  • the system stays in a stable state with no manual intervention.

Summary:

Redis Sentinel provides fault tolerance through three mechanisms:

  1. Monitoring the availability of every node.
  2. A Sentinel vote to confirm the failure.
  3. Automatic failover and updating the clients' configuration.

This lets Redis recover on its own after a master fails, with no data loss (other than data that hadn't yet reached the replicas because of asynchronous replication).

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.