Cluster failover helps keep your Redis database working even if one part stops. It switches to a backup automatically.
0
0
Cluster failover in Redis
Introduction
When a Redis master node crashes and you want the system to keep working without manual help.
When you want to avoid downtime in your app that uses Redis for fast data storage.
When you have multiple Redis nodes and want automatic recovery if one fails.
When you want to improve reliability by having backup nodes ready to take over.
When you want to maintain data availability during network or hardware problems.
Syntax
Redis
CLUSTER FAILOVER [FORCE|TAKEOVER]
FORCE makes a replica become master even if the current master is still reachable.
TAKEOVER forces failover immediately, ignoring some safety checks.
Examples
Starts a failover if the master is unreachable, promoting the replica.
Redis
CLUSTER FAILOVER
Forces the replica to become master even if the old master is still online.
Redis
CLUSTER FAILOVER FORCE
Immediately makes the replica master, ignoring safety checks.
Redis
CLUSTER FAILOVER TAKEOVER
Sample Program
This command tells the replica to try to become the master if the current master is down.
Redis
# Connect to a Redis replica node and run failover
CLUSTER FAILOVER
OutputSuccess
Important Notes
Failover only works if Redis Cluster is properly set up with masters and replicas.
Using FORCE or TAKEOVER can cause data loss if not used carefully.
Always monitor your cluster after failover to ensure data consistency.
Summary
Cluster failover switches a replica to master if the master fails.
It helps keep Redis available without manual intervention.
Use FORCE or TAKEOVER options carefully to avoid problems.