# REPLICATION.FAILOVER

> Promote this replica to primary, outside cluster mode.

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

```
REPLICATION.FAILOVER
```

- Group: Replication
- Complexity: O(1)
- HotKV Cloud: Scale plan
- On-Premise: requires the replication license feature

`REPLICATION.FAILOVER` promotes the receiving replica to primary: it stops
following its primary, keeps the data it has, starts accepting writes, and
accepts replicas of its own. Use it when the primary of a non-cluster
deployment is lost or being retired. Point your clients, and any other
replicas, at the new primary afterwards.

Writes the old primary accepted but had not yet sent to this replica are not
on the new primary, so if the old primary is still up, stop writes to it (or
let the replica catch up) first. In cluster mode, use
[CLUSTER FAILOVER](https://docs.hotkv.com/commands/cluster-failover/index.md) instead.

## Return value

Simple string `OK` in RESP2 and RESP3, or one of these errors:

| Case | Error |
| --- | --- |
| Cluster mode is on | `ERR In cluster mode use CLUSTER FAILOVER` |
| The node is not a replica | `ERR This node is not a replica` |
| The node could not start as primary | `ERR Replication could not start as primary, see the server log` |
| No license that includes `replication` | `NOLICENSE replication requires a HotKV license. Contact sales@hotkv.com` |

## Examples

```
127.0.0.1:6380> REPLICATION.FAILOVER
OK
127.0.0.1:6379> REPLICATION.FAILOVER
(error) ERR This node is not a replica
```

## Compatibility

HotKV-only command. The Redis `FAILOVER` command is accepted by HotKV only
for compatibility and replies with an error; `REPLICAOF NO ONE` also
promotes a replica.

## See also

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