0
0
Redisquery~5 mins

Failover manual process in Redis

Choose your learning style9 modes available
Introduction
Failover helps keep your Redis service running by switching to a backup if the main one stops working.
When the main Redis server crashes or becomes unreachable.
During planned maintenance to switch to a backup server without downtime.
If you notice slow responses or errors from the current Redis master.
When you want to test your backup Redis server by making it the main one temporarily.
Syntax
Redis
redis-cli -h <replica-host> -p <replica-port> CLUSTER FAILOVER
Connect to the replica node you want to promote to master using its host and port.
This command is used in Redis Cluster setups to manually trigger failover.
Examples
This command triggers failover on the replica node at 127.0.0.1:7001, making it the new master.
Redis
redis-cli -h 127.0.0.1 -p 7001 CLUSTER FAILOVER
Manually promotes the specified replica node to master in the Redis cluster.
Redis
redis-cli -h 127.0.0.1 -p 7004 CLUSTER FAILOVER
Sample Program
This command manually triggers failover on the Redis cluster replica node at 127.0.0.1:7001.
Redis
redis-cli -h 127.0.0.1 -p 7001 CLUSTER FAILOVER
OutputSuccess
Important Notes
Manual failover should be done carefully to avoid data loss.
Make sure the node you promote has the latest data before failover.
Use Redis Cluster commands only if your setup is a Redis Cluster.
Summary
Failover switches Redis master to a backup to keep service running.
Use 'redis-cli -h -p CLUSTER FAILOVER' to trigger manual failover.
Always confirm the new master is ready to serve data.