DEV Community

Cover image for Redis Replica or Cluster. Sentinels is not even a part of the differentiation
Tuçe Sarı Tekkalmaz
Tuçe Sarı Tekkalmaz

Posted on

Redis Replica or Cluster. Sentinels is not even a part of the differentiation

Last month I came across someone explaining Redis Sentinel as the magic behind Redis replication. According to them, Sentinel is what makes Redis work “under the hood” in all cases.
No. Just—no.

There’s a fundamental misconception here. Redis offers two distinct setup modes: Replica mode and Cluster mode. And Sentinels? They might show up in one of them—but they’re not part of the core differentiation. Let’s break this down properly.


1. Redis Replica Mode

This is the traditional master-replica setup. It’s simple and suits many common caching and read-scaling use cases.

  • One primary/master handles all writes.
  • One or more replicas/slaves sync data from the master.
  • Replicas can serve read traffic to reduce the load on the master.
  • Data is replicated asynchronously.

If the master fails, Redis Sentinel can help. Sentinel is a separate service that monitors Redis instances, elects a new master, and helps your application reconnect to the new topology. But again—Sentinel is optional. You could use your own failover mechanism.

So when to use Replica Mode:

  • If you want simplicity.
  • If you mostly care about caching, not partitioned data.
  • If you need basic high availability with optional Sentinel.
  • If you can tolerate eventual consistency in failover.

2. Redis Cluster Mode

Redis Cluster is different. It adds automatic data sharding and built-in failover.

  • Data is split across multiple masters using hash slots (16,384 slots in total).
  • Each master can have one or more replicas.
  • If one master fails, a replica is promoted automatically.
  • Clients are cluster-aware and know where to send requests based on key hash slots.

No Sentinel is used here. Redis Cluster has its own failure detection and promotion mechanism built in. Sentinels are completely irrelevant in this context.

So when to use Cluster Mode:

  • If you need horizontal scaling across multiple nodes.
  • If you want high availability without external tools.
  • If your dataset no longer fits on a single machine.
  • If you’re OK with the complexity of partitioned keys and client-side awareness.

What’s Sentinel Then?

Redis Sentinel is a monitoring and failover tool only for Replica mode. It:

  • Watches Redis masters and replicas.
  • Detects failures.
  • Elects a new master when needed.
  • Notifies clients of topology changes.

Summary

Redis is becoming more powerful with every release. It offers a wide range of features, and I’ll be sharing code examples in upcoming posts.

One common source of confusion is the difference between hash slots and keys when using Cluster mode. This concept plays a critical role in data distribution and routing. I’ll dive deeper into hash slot behavior and its relationship with keys in a dedicated follow-up post.


Top comments (0)