Redis Cluster Interview Questions

Master Redis Cluster with interview-focused questions covering Cluster Architecture, Hash Slots, Sharding, Cluster Nodes, Slot Migration, High Availability, Failover, Gossip Protocol, Cluster Bus, Scaling, and enterprise production best practices.

Introduction

As applications grow,

a single Redis server eventually reaches its limits in

  • Memory
  • CPU
  • Network Bandwidth
  • Availability

Redis Cluster solves these limitations by distributing data across multiple Redis nodes.

Redis Cluster provides

  • Horizontal Scaling
  • Automatic Sharding
  • High Availability
  • Fault Tolerance
  • Automatic Failover

Today Redis Cluster is widely used in

  • Banking
  • E-Commerce
  • Gaming
  • Social Media
  • FinTech
  • Cloud Native Applications

Redis Cluster Architecture

flowchart LR

Application --> RedisCluster["Redis Cluster"]

RedisCluster["Redis Cluster"] --> Master1["Master 1"]

RedisCluster["Redis Cluster"] --> Master2["Master 2"]

RedisCluster["Redis Cluster"] --> Master3["Master 3"]

Master1["Master 1"] --> Replica1["Replica 1"]

Master2["Master 2"] --> Replica2["Replica 2"]

Master3["Master 3"] --> Replica3["Replica 3"]

1. What is Redis Cluster?

Answer

Redis Cluster is a distributed Redis deployment that automatically partitions data across multiple Redis nodes.

Benefits include

  • Horizontal Scaling
  • High Availability
  • Automatic Failover
  • Better Performance

2. Why is Redis Cluster required?

Without Cluster

One Redis Server

↓

Memory Full

↓

Cannot Scale

With Cluster

Multiple Redis Servers

↓

Data Distributed

↓

Scalable

3. What problems does Redis Cluster solve?

  • Single Server Memory Limits
  • Single Point of Failure
  • Read/Write Scalability
  • High Availability
  • Fault Tolerance

Redis Cluster Components

Redis Cluster

├── Master Nodes
├── Replica Nodes
├── Hash Slots
└── Cluster Bus

4. What is Sharding?

Sharding is the process of splitting data across multiple servers.

Instead of storing all keys on one Redis instance,

keys are distributed across multiple nodes.


Sharding

flowchart LR

Keys --> Master1["Master 1"]

Keys --> Master2["Master 2"]

Keys --> Master3["Master 3"]

5. What is a Hash Slot?

Redis Cluster divides the key space into

16,384 Hash Slots

Every key belongs to exactly one slot.


Hash Slot Distribution

16384 Slots

↓

Master 1

0 - 5460

↓

Master 2

5461 - 10922

↓

Master 3

10923 - 16383

6. How is a slot selected?

Redis computes

CRC16(Key)

↓

Modulo 16384

↓

Hash Slot

The slot determines which master stores the key.


Slot Calculation

flowchart LR

Key --> Crc16Modulo16384Hash["CRC16 --> Modulo 16384 --> Hash Slot --> MasterNode["Master Node"]"]

7. Why does Redis use 16,384 slots?

Advantages

  • Even Distribution
  • Easy Rebalancing
  • Efficient Migration
  • Simple Cluster Management

8. What is a Master Node?

Master Nodes

  • Store Data
  • Accept Writes
  • Own Hash Slots

9. What is a Replica Node?

Replica Nodes

  • Copy Master Data
  • Handle Failover
  • Can serve read requests (application-dependent)

Cluster Architecture

flowchart LR

Master1["Master 1"] --> Replica1["Replica 1"]

Master2["Master 2"] --> Replica2["Replica 2"]

Master3["Master 3"] --> Replica3["Replica 3"]

10. How many masters are required?

Minimum

3 Masters

Recommended Production

3 Masters

+

3 Replicas

Total

6 Nodes

11. What is Automatic Sharding?

Redis automatically determines

which node stores a key.

Applications simply execute

SET

GET

without managing shard locations.


12. What happens when memory is exhausted?

Add another master.

Redis redistributes

hash slots

across cluster nodes.


Cluster Scaling

flowchart LR

3Masters["3 Masters"] --> AddMasterSlotMigration["Add Master --> Slot Migration --> BalancedCluster["Balanced Cluster"]"]

13. What is Slot Migration?

Redis moves

hash slots

between master nodes

without stopping the cluster.

Used for

  • Scaling
  • Maintenance
  • Rebalancing

14. What is Rebalancing?

Rebalancing redistributes slots evenly

after

  • New Nodes
  • Removed Nodes
  • Capacity Changes

15. What happens if a Master fails?

Replica detects failure.

Replica becomes

the new Master.

Automatic failover occurs.


Failover Workflow

flowchart LR

MasterFailure["Master Failure"] --> ReplicaPromotionNewMaster["Replica Promotion --> New Master --> Application"]

16. How is failure detected?

Cluster nodes continuously exchange health information.

If enough masters agree that a node is unreachable,

it is marked as failed.


17. What is the Cluster Bus?

Cluster Bus is a dedicated communication channel used internally by Redis Cluster.

It exchanges

  • Health Information
  • Slot Ownership
  • Failover Messages
  • Configuration Updates

Applications never use the Cluster Bus directly.


Cluster Bus

flowchart LR

Master1["Master 1"]

<--> Master2["Master 2"]

Master2["Master 2"]

<--> Master3["Master 3"]

Master3["Master 3"]

<--> Replica

18. What is the Gossip Protocol?

Redis Cluster uses a Gossip Protocol

to exchange

node status

between cluster members.

Benefits

  • Failure Detection
  • Health Monitoring
  • Cluster Synchronization

19. What is a MOVED response?

If a client contacts

the wrong node,

Redis returns

MOVED

telling the client

which node owns the requested slot.


MOVED Example

Client

↓

Wrong Node

↓

MOVED

↓

Correct Node

20. What is ASK redirection?

ASK occurs

during slot migration.

The key is temporarily located

on another node.

Unlike MOVED,

ASK is temporary.


MOVED vs ASK

MOVED ASK
Permanent Slot Ownership Temporary During Migration
Client Updates Slot Cache Used Only During Migration

21. Can Redis Cluster support transactions?

Transactions work

only if

all keys belong

to the same hash slot.

Multi-slot transactions are not supported.


22. What are Hash Tags?

Hash Tags force multiple keys

into

the same slot.

Example

cart:{101}:items

cart:{101}:price

Both keys share

{101}

and therefore the same slot.


Hash Tag Example

{101}

↓

Hash Slot

↓

Same Master

23. Banking Example

Customer Accounts

Hash Slots

Distributed Across Masters

High Availability


24. E-Commerce Example

Shopping Cart

Hash Tag

Single Slot

Atomic Operations


25. Gaming Example

Leaderboards

Cluster

Millions of Players

Horizontal Scaling


26. Analytics Example

User Events

Distributed

Multiple Masters

High Throughput


27. Production Example

20 Million Users

3 Masters

Memory Full

Add 3 Masters

Slot Rebalancing

Application Continues


28. Common Cluster Problems

  • Uneven Slot Distribution
  • Hot Keys
  • Large Slot Migration
  • Network Latency
  • Replica Failure
  • Incorrect Client Configuration

29. Redis Cluster vs Replication

Replication Cluster
High Availability High Availability + Scaling
Same Data Partitioned Data
No Sharding Automatic Sharding
Read Scaling Horizontal Scaling

30. Redis Cluster Best Practices

  • Use at least 3 Masters.
  • Deploy one Replica per Master.
  • Monitor slot distribution.
  • Avoid hot keys.
  • Use Hash Tags carefully.
  • Monitor cluster health.
  • Test failover regularly.
  • Use Redis Cluster-aware clients.
  • Separate cluster traffic from application traffic.
  • Monitor memory usage continuously.

Redis Cluster Workflow

flowchart LR

Application --> ClusterClientHashSlot["Cluster Client --> Hash Slot --> Master"]

Master --> Replica

Enterprise Best Practices

  • Deploy a minimum of six nodes (3 Masters + 3 Replicas).
  • Use Redis Cluster instead of manual sharding.
  • Monitor cluster health with CLUSTER INFO.
  • Balance hash slots evenly.
  • Avoid oversized keys.
  • Keep replicas in different availability zones when possible.
  • Use Cluster-aware client libraries.
  • Monitor failover events.
  • Combine Redis Cluster with persistence.
  • Test disaster recovery regularly.

Quick Revision

Topic Key Point
Redis Cluster Distributed Redis
Sharding Data Distribution
Hash Slots 16,384 Slots
Master Owns Slots
Replica Backup Node
CRC16 Slot Calculation
Slot Migration Move Slots
Rebalancing Balance Cluster
Cluster Bus Internal Communication
Gossip Protocol Health Monitoring
MOVED Permanent Redirect
ASK Temporary Redirect
Hash Tags Same Slot Keys

Interview Tips

Interviewers frequently ask

  • What is Redis Cluster?
  • Why does Redis Cluster use 16,384 hash slots?
  • Explain Sharding.
  • What is a Hash Slot?
  • Master vs Replica.
  • What is Slot Migration?
  • What is Rebalancing?
  • What happens when a Master fails?
  • MOVED vs ASK.
  • Explain Hash Tags with an example.

A strong interview explanation is:

"Redis Cluster provides horizontal scalability and high availability by partitioning data into 16,384 hash slots distributed across multiple master nodes. Each master owns a subset of slots, while replicas provide failover protection. Redis uses CRC16 to map keys to slots and automatically redirects clients using MOVED or ASK responses when necessary. Features such as automatic sharding, slot migration, rebalancing, and failover make Redis Cluster ideal for large-scale enterprise systems."


Summary

Redis Cluster is the distributed version of Redis designed for horizontal scaling, fault tolerance, and high availability. By distributing keys across 16,384 hash slots, Redis automatically balances data among master nodes while replicas ensure resilience during failures. Features such as slot migration, rebalancing, Cluster Bus, Gossip Protocol, Hash Tags, and automatic failover enable enterprise-grade scalability and reliability.

Understanding Redis Cluster architecture, sharding, slot management, failover, and production best practices is essential for Backend Developers, Redis Engineers, DevOps Engineers, Microservices Engineers, and Solution Architects building highly scalable distributed applications.