CLUSTER...OTSRANGE(3valkey)
π CLUSTER ADDSLOTSRANGE β the 3valkey girlies know π
okay bestie, pull up a chair, because this one is genuinely iconic and also kinda niche. it lives in the 3valkey manual section, so if you ever see CLUSTER...OTSRANGE(3valkey) floating around in a header, that's literally just this page being shy about its full name. π
β¨ NAME β¨
cluster-addslotsrange β Assigns new hash slot ranges to a node. no cap, that's the whole job. π
β¨ SYNOPSIS β¨
CLUSTER ADDSLOTSRANGE start-slot end-slot [start-slot end-slot ...]
β¨ DESCRIPTION β¨
okay so CLUSTER ADDSLOTSRANGE is the sister command to valkey-cluster-addslots(7) / CLUSTER ADDSLOTS β they're both out here handing hash slots to nodes. same goal, different font. π«Ά
the glow-up is in the how:
CLUSTER ADDSLOTSwants a list of slots to assign to the node.CLUSTER ADDSLOTSRANGEwants a list of slot ranges β specified by a start slot and an end slot β to assign to the node.
so instead of typing every single slot like a peasant, you just say "from here to there" and she β¨understandsβ¨. it's giving efficiency, honestly.
β¨ REPLY β¨
valkey-protocol(7) Simple string reply: OK if the command was successful. otherwise? an error gets returned. π so if you see OK, slay. if you see an error, we investigate.
β¨ COMPLEXITY β¨
O(N) where N is the total number of slots between the start slot and end slot arguments. big ranges = more work, obviously. it scales with how much you asked for. π¦
β¨ ACL CATEGORIES β¨
@admin@dangerous@slow
β οΈ bestie notice the @dangerous tag. this is not a little cute command you sprinkle around for fun. it touches cluster topology. be intentional. π
β¨ HISTORY β¨
- Available since: 7.0.0 π (so it's a newer baby, not an ancient relic)
π Example π
say you wanna assign slots 1 2 3 4 5 to the node. the CLUSTER ADDSLOTS way looks like this:
> CLUSTER ADDSLOTS 1 2 3 4 5
OK
and the exact same operation, but with CLUSTER ADDSLOTSRANGE:
> CLUSTER ADDSLOTSRANGE 1 5
OK
see?? 1 5 instead of 1 2 3 4 5. shorter, cleaner, main character energy. π
same result, less typing, periodt.
π§ Usage in Valkey Cluster π§
heads up: this command only works in cluster mode. and it's genuinely useful for these Valkey Cluster operations:
- To create a new cluster,
CLUSTER ADDSLOTSRANGEis used to initially set up primary nodes splitting the available hash slots among them. π - In order to fix a broken cluster where certain slots are unassigned. π©Ή (the rescue arc, we love to see it)
β¨ SEE ALSO β¨
asking(3valkey), cluster(3valkey), cluster-addslots(3valkey), cluster-bumpepoch(3valkey), cluster-cancelslotmigrations(3valkey), cluster-count-failure-reports(3valkey), cluster-countkeysinslot(3valkey), cluster-delslots(3valkey), cluster-delslotsrange(3valkey), cluster-failover(3valkey), cluster-flushslots(3valkey), cluster-forget(3valkey), cluster-getkeysinslot(3valkey), cluster-getslotmigrations(3valkey), cluster-help(3valkey), cluster-info(3valkey), cluster-keyslot(3valkey), cluster-links(3valkey), cluster-meet(3valkey), cluster-migrateslots(3valkey), cluster-myid(3valkey), cluster-myshardid(3valkey), cluster-nodes(3valkey), cluster-replicas(3valkey), cluster-replicate(3valkey), cluster-reset(3valkey), cluster-saveconfig(3valkey), cluster-set-config-epoch(3valkey), cluster-setslot(3valkey), cluster-shards(3valkey), cluster-slot-stats(3valkey), cluster-slots(3valkey), cluster-syncslots(3valkey), readonly(3valkey), readwrite(3valkey)
and that's the whole page bestie!! πΈ this lil' entry is from the Valkey Command Manual, version 9.0.0, dated 2025-10-21. go forth and assign those ranges responsibly. mwah πβ¨
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms