CLUSTER-DELSLOTS(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

✨ CLUSTER-DELSLOTS ✨

okay bestie, so we're in the valkey command manual and today's main character is cluster-delslots πŸ’…


🌸 NAME 🌸

cluster-delslots β€” sets hash slots as unbound for a node. yes fr, it just… makes a node forget who owns a slot 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

CLUSTER DELSLOTS slot [slot...]

πŸ’– DESCRIPTION πŸ’–

so in Valkey Cluster, every node keeps track of which primary is serving a particular hash slot. that's the whole vibe πŸ‘‘

CLUSTER DELSLOTS asks a particular Valkey Cluster node to forget which primary is serving the hash slots you passed as arguments. just straight up amnesia, iconic honestly 😭

when a node has received a CLUSTER DELSLOTS command and has consequently removed the associations for the passed hash slots, we say those hash slots are unbound. and like, unbound hash slots are a totally natural thing to happen when a node hasn't been configured to handle them (something you can do with the valkey-cluster-addslots(7) CLUSTER ADDSLOTS command) and if it hasn't received any info about who owns those hash slots (something it can learn from heartbeat or update messages). it's giving "idk her" energy πŸ’€

if a node with unbound hash slots receives a heartbeat packet from another node that claims to be the owner of some of those hash slots, the association is established instantly. no waiting, no drama, just slay ✨ and moreover, if a heartbeat or update message is received with a configuration epoch greater than the node's own, the association is re-established. boom, back together πŸ₯°

BUT. however. bestie listen up, note that:

  1. The command only works if all the specified slots are already associated with some node.
  2. The command fails if the same slot is specified multiple times. (pick a lane pls πŸ™ˆ)
  3. As a side effect of the command execution, the node may go into down state because not all hash slots are covered. that's the risk, that's the cost, that's the girlboss tragedy 😭

πŸŽ€ REPLY πŸŽ€

valkey-protocol(7) Simple string reply: OK if the command was successful. otherwise an error is returned. so basically: either OK or it's not okay πŸ’…


πŸ”₯ COMPLEXITY πŸ”₯

O(N) where N is the total number of hash slot arguments. linear, clean, no surprises ✨


πŸ’œ ACL CATEGORIES πŸ’œ

@admin @dangerous @slow

dangerous?? slow?? yeah bestie this one's got lore. handle with care 🌸

🌈 HISTORY 🌈

  • Available since: 3.0.0 β€” an elder, a classic, a legend πŸ‘‘

πŸ“ Example πŸ“

the following command removes the association for slots 5000 and 5001 from the node receiving the command:

> CLUSTER DELSLOTS 5000 5001
OK

ate that. no crumbs. 😌

🧚 Usage in Valkey Cluster 🧚

this command only works in cluster mode and may be useful for debugging and in order to manually orchestrate a cluster configuration when a new cluster is created. it is currently not used by valkey-cli, and mainly exists for API completeness. so like, it's there for the sake of being there. we respect it for that 🫑


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page bestie!! βœ¨πŸ’– this one's from Valkey 9.0.0, dated 2025-10-21, and it lives in the CLUSTER-DELSLOTS(3valkey) corner of the manual. go unbound some slots, but like… responsibly πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from