0
0
Redisquery~10 mins

Cluster failover in Redis - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Cluster failover
Primary Node Active
Primary Node Fails?
NoContinue Serving
Yes
Detect Failure
Promote Replica to Primary
Redirect Clients to New Primary
Cluster Continues Operating
The cluster monitors the primary node; if it fails, a replica is promoted to primary and clients are redirected to maintain service.
Execution Sample
Redis
1. Primary node fails
2. Cluster detects failure
3. Replica promoted to primary
4. Clients redirected
5. Service continues
This sequence shows how a Redis cluster handles a primary node failure by promoting a replica to keep the cluster running.
Execution Table
StepEventAction TakenNode Role ChangesClient Impact
1Primary node is activeNo actionPrimary activeClients connected to primary
2Primary node failsFailure detectedPrimary downClients lose connection
3Replica detects failureReplica promotedReplica becomes new primaryClients must reconnect
4Clients redirectedClients connect to new primaryNew primary activeService restored
5Cluster stableMonitoring continuesNew primary activeNormal operation
6No further failureNo actionNew primary activeClients connected
💡 Cluster stabilizes after replica promotion and client reconnection
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
Primary Node StatusActiveFailedDownDownDown
Replica Node StatusReplicaReplicaPromoted to PrimaryPrimaryPrimary
Client ConnectionConnected to PrimaryDisconnectedDisconnectedConnected to New PrimaryConnected
Key Moments - 3 Insights
Why do clients lose connection immediately after the primary node fails?
Because the primary node is down (see execution_table step 2), clients lose their connection until the cluster promotes a replica and redirects them.
How does the cluster decide which replica to promote?
The cluster uses internal consensus and health checks to select a healthy replica to promote, ensuring minimal downtime (implied in step 3).
What happens if clients do not reconnect to the new primary?
Clients will not be able to perform writes or reads that require the primary, causing service disruption until reconnection (see execution_table step 4).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the status of the primary node at step 3?
AActive
BFailed
CDown
DPromoted
💡 Hint
Check the 'Node Role Changes' column at step 3 in the execution_table.
At which step do clients reconnect to the new primary node?
AStep 2
BStep 4
CStep 3
DStep 5
💡 Hint
Look at the 'Client Impact' column for when clients connect to the new primary.
If the replica fails to promote, what would likely happen to the cluster?
ACluster remains down until manual intervention
BClients continue as normal
CAnother replica is promoted automatically
DPrimary node recovers automatically
💡 Hint
Consider the failover steps and what happens if promotion does not occur (refer to key_moments).
Concept Snapshot
Cluster failover in Redis:
- Primary node failure triggers detection
- Replica promoted to primary
- Clients redirected to new primary
- Cluster continues serving without manual restart
- Ensures high availability and minimal downtime
Full Transcript
In Redis cluster failover, the primary node is monitored continuously. When it fails, the cluster detects this failure and promotes a replica node to become the new primary. Clients lose connection briefly but are redirected to the new primary to continue operations. This process ensures the cluster remains available and operational with minimal downtime. Variables such as node status and client connections change step-by-step during failover, as shown in the execution table. Understanding these steps helps grasp how Redis maintains high availability.