# CLUSTER RESET

> Reset the receiving node's cluster state so that it can join a cluster again from scratch.

URL: https://docs.hotkv.com/commands/cluster-reset/

```
CLUSTER RESET [HARD | SOFT]
```

- Group: Cluster
- Complexity: O(N) where N is the number of known nodes
- HotKV Cloud: all plans
- On-Premise: no license needed

`CLUSTER RESET` takes the receiving node out of its cluster. The node
forgets every other node, drops all its slots and slot migrations, and
closes its cluster bus links. Use it to reuse a node in a new cluster, or to
rebuild a cluster in tests. To bring the node back, meet it again with
[CLUSTER MEET](https://docs.hotkv.com/commands/cluster-meet/index.md).

A primary must hold no keys (HotKV's AI feature data counts as keys here).
A replica becomes an empty primary: its copy of the old primary's data is
deleted.

## Options

| Option | Effect |
| --- | --- |
| `SOFT` (default) | Keeps the node ID and its epochs. A replica gets a shard ID of its own. |
| `HARD` | Also gives the node a new ID and sets its epochs back to 0. |

The node keeps its address, its hostname and its human-readable name
through either reset.

## Return value

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

| Case | Error |
| --- | --- |
| A primary that holds keys | `ERR CLUSTER RESET can't be called with master nodes containing keys` |
| An option other than `HARD` or `SOFT` | `ERR syntax error` |

## Examples

On a replica the reset drops its copy of the data and leaves an empty primary with no slots:

```
127.0.0.1:7003> CLUSTER RESET
OK
$ redis-cli -p 7003 INFO replication | grep -E "role|connected"
role:master
connected_slaves:0
$ redis-cli -p 7003 CLUSTER NODES | cut -d" " -f2,3,9
127.0.0.1:7003@17003 myself,master
```

On a primary that holds keys:

```
127.0.0.1:6379> CLUSTER RESET
(error) ERR CLUSTER RESET can't be called with master nodes containing keys
127.0.0.1:6379> FLUSHALL
OK
127.0.0.1:6379> CLUSTER RESET HARD
OK
127.0.0.1:6379> CLUSTER INFO
cluster_enabled:1
cluster_state:fail
cluster_slots_assigned:0
...
```

## Compatibility

Same options, effects and error strings as Redis 7 and Valkey 8.

## See also

[CLUSTER MEET](https://docs.hotkv.com/commands/cluster-meet/index.md), [CLUSTER FORGET](https://docs.hotkv.com/commands/cluster-forget/index.md),
[CLUSTER FLUSHSLOTS](https://docs.hotkv.com/commands/cluster-flushslots/index.md), [CLUSTER REPLICATE](https://docs.hotkv.com/commands/cluster-replicate/index.md),
[Scaling a cluster](https://docs.hotkv.com/clustering/scaling/index.md#remove-a-node)