Detailed Explanation of Redis Three Cluster Modes: Master‑Slave Replication, Sentinel, and Cluster
This article explains Redis's three clustering approaches—master‑slave replication, Sentinel, and native Cluster—detailing their architectures, replication mechanisms, advantages, disadvantages, and suitable scenarios for high‑availability and high‑concurrency database deployments.
Redis offers three clustering solutions—master‑slave replication, Sentinel, and native Cluster—each with distinct architectures, advantages, and trade‑offs.
Master‑Slave Replication uses a single master node for writes and reads, with one or more slave nodes that replicate data from the master. The replication process involves the slave sending SYNC, the master sending a snapshot and buffered commands, and subsequent write commands being streamed to slaves. Advantages include read/write separation and improved performance; the main drawback is the need for manual failover when the master fails.
Sentinel Mode adds automatic monitoring and failover to the master‑slave setup. Multiple Sentinel instances continuously ping masters and slaves; upon detecting a master outage, they elect a new master and notify clients, providing high availability without manual intervention. Its strengths are automatic failover and robustness, while the added complexity and maintenance overhead are disadvantages.
Redis Cluster Mode implements sharding across multiple master‑slave groups, using 16,384 hash slots. Keys are assigned to slots via CRC16, and each slot maps to a specific node, enabling horizontal scaling and high throughput. Each master can have replicas for redundancy, and the cluster handles failover automatically. This mode is suited for massive data, high concurrency, and high‑availability scenarios, offering better performance than Sentinel for large‑scale deployments.
The article includes diagrams illustrating each architecture and discusses use‑case considerations for selecting the appropriate Redis deployment model.
Mike Chen's Internet Architecture
Over ten years of BAT architecture experience, shared generously!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.