FAILOVER
FAILOVER [TO host port [FORCE]] [ABORT] [TIMEOUT milliseconds]
- Group
- Server
- Arity
- -1 (at least 1 words, counting the command name)
- Flags
- admin
- HotKV Cloud
- All plans
- On-Premise
- no license needed
In Redis, FAILOVER makes a primary hand its role to one of its replicas.
HotKV accepts the command so that tools which send it get a clear answer,
but does not perform a failover with it:
FAILOVERwith any arguments that do not includeABORTreplies with an error.FAILOVER ABORT(or any arguments that includeABORT) repliesOK, since there is never aFAILOVERin progress to cancel.
To fail over:
- on a primary and replicas set up with HotKV replication, use REPLICATION.FAILOVER, or REPLICAOF NO ONE on the replica;
- in a cluster, use CLUSTER FAILOVER on the replica.
Return value
Section titled “Return value”| Case | Reply (RESP2 and RESP3) |
|---|---|
Arguments include ABORT |
Simple string OK |
| Anything else | Error ERR FAILOVER requires a running replica; replication is not configured |
The error text is the same whether or not replication is configured.
Examples
Section titled “Examples”127.0.0.1:6379> FAILOVER(error) ERR FAILOVER requires a running replica; replication is not configured127.0.0.1:6379> FAILOVER ABORTOKCompatibility
Section titled “Compatibility”Redis 7 and Valkey 8 implement coordinated failover with this command. HotKV does not; see the alternatives above.
See also
Section titled “See also”REPLICATION.FAILOVER, CLUSTER FAILOVER, REPLICAOF, high availability
In a cluster: Replicas and failover
Was this page helpful?
Thanks for the feedback.