# FAILOVER

> Accepted for compatibility only. Use REPLICATION.FAILOVER or CLUSTER FAILOVER to fail over.

URL: https://docs.hotkv.com/commands/failover/

```
FAILOVER [TO host port [FORCE]] [ABORT] [TIMEOUT milliseconds]
```

- Group: Server
- 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:

- `FAILOVER` with any arguments that do not include `ABORT` replies with an
  error.
- `FAILOVER ABORT` (or any arguments that include `ABORT`) replies `OK`,
  since there is never a `FAILOVER` in progress to cancel.

To fail over:

- on a primary and replicas set up with HotKV replication, use
  [REPLICATION.FAILOVER](https://docs.hotkv.com/commands/replication-failover/index.md), or
  [REPLICAOF NO ONE](https://docs.hotkv.com/commands/replicaof/index.md) on the replica;
- in a cluster, use [CLUSTER FAILOVER](https://docs.hotkv.com/commands/cluster-failover/index.md) on the
  replica.

## 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

```
127.0.0.1:6379> FAILOVER
(error) ERR FAILOVER requires a running replica; replication is not configured
127.0.0.1:6379> FAILOVER ABORT
OK
```

## Compatibility

Redis 7 and Valkey 8 implement coordinated failover with this command. HotKV
does not; see the alternatives above.

## See also

[REPLICATION.FAILOVER](https://docs.hotkv.com/commands/replication-failover/index.md),
[CLUSTER FAILOVER](https://docs.hotkv.com/commands/cluster-failover/index.md), [REPLICAOF](https://docs.hotkv.com/commands/replicaof/index.md),
[high availability](https://docs.hotkv.com/operate/high-availability/index.md)

In a cluster: [Replicas and failover](https://docs.hotkv.com/clustering/replicas-and-failover/index.md#start-a-failover-yourself)