CLUSTER RESET
CLUSTER RESET [HARD | SOFT]
- Group
- Cluster
- Complexity
- O(N) where N is the number of known nodes
- Arity
- -2 (at least 2 words, counting the command name)
- 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.
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
Section titled “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
Section titled “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
Section titled “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 RESETOK$ redis-cli -p 7003 INFO replication | grep -E "role|connected"role:masterconnected_slaves:0$ redis-cli -p 7003 CLUSTER NODES | cut -d" " -f2,3,9127.0.0.1:7003@17003 myself,masterOn a primary that holds keys:
127.0.0.1:6379> CLUSTER RESET(error) ERR CLUSTER RESET can't be called with master nodes containing keys127.0.0.1:6379> FLUSHALLOK127.0.0.1:6379> CLUSTER RESET HARDOK127.0.0.1:6379> CLUSTER INFOcluster_enabled:1cluster_state:failcluster_slots_assigned:0...Compatibility
Section titled “Compatibility”Same options, effects and error strings as Redis 7 and Valkey 8.
See also
Section titled “See also”CLUSTER MEET, CLUSTER FORGET, CLUSTER FLUSHSLOTS, CLUSTER REPLICATE, Scaling a cluster
Was this page helpful?
Thanks for the feedback.