# CLUSTER FLUSHSLOTS

> Remove every hash slot the receiving node owns, and close its slot migrations.

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

```
CLUSTER FLUSHSLOTS
```

- Group: Cluster
- Complexity: O(1)
- HotKV Cloud: not available
- On-Premise: no license needed

`CLUSTER FLUSHSLOTS` removes every hash slot the receiving node owns from
its slot table, and ends any slot import or migration it had open. The change
is saved to `nodes.conf`. The slots are then unassigned in this node's view;
the other nodes are not told. It is mainly a repair and test tool, for
example before giving a node a fresh set of slots with
[CLUSTER ADDSLOTS](https://docs.hotkv.com/commands/cluster-addslots/index.md).

The node must hold no keys: with keys it replies
`ERR DB must be empty to perform CLUSTER FLUSHSLOTS.` and changes nothing.
Empty it first (for example with `FLUSHALL`).

## Return value

Simple string `OK` in RESP2 and RESP3. Errors: `ERR DB must be empty to perform
CLUSTER FLUSHSLOTS.` when the node holds keys, and, with cluster mode off,
`ERR This instance has cluster support disabled`.

## Examples

```
127.0.0.1:6379> CLUSTER FLUSHSLOTS
OK
127.0.0.1:6379> CLUSTER INFO
cluster_enabled:1
cluster_state:fail
cluster_slots_assigned:0
...
```

A node that holds a key refuses it:

```
127.0.0.1:7000> CLUSTER FLUSHSLOTS
(error) ERR DB must be empty to perform CLUSTER FLUSHSLOTS.
```

## Compatibility

As in Redis 7 and Valkey 8, `CLUSTER FLUSHSLOTS` is refused while the node
holds keys.

## See also

[CLUSTER DELSLOTS](https://docs.hotkv.com/commands/cluster-delslots/index.md),
[CLUSTER RESET](https://docs.hotkv.com/commands/cluster-reset/index.md),
[CLUSTER ADDSLOTS](https://docs.hotkv.com/commands/cluster-addslots/index.md)

In a cluster: [Scaling a cluster](https://docs.hotkv.com/clustering/scaling/index.md#resharding-by-hand)