CLUSTER-MYSHARDID(3valkey)
π CLUSTER-MYSHARDID π
okay bestie, so this is a valkey command page β cluster-myshardid(3valkey) if you wanna be formal about it. it lives in the valkey command manual and it's about to tell you which shard your node is repping. slay.
β¨ NAME β¨
cluster-myshardid β returns the shard ID of a node. that's it. that's the whole job. and it does it flawlessly, no cap. π
πΈ SYNOPSIS πΈ
CLUSTER MYSHARDID
literally just that. no args, no drama, no extra syllables. it's giving minimalism. π
π¦ DESCRIPTION π¦
so when you run this, it hands you back the node's shard id. simple.
but like, let me give you the β¨loreβ¨ β CLUSTER MYSHARDID returns the unique, auto-generated identifier that's associated with the shard that the connected cluster node belongs to. so every shard in your cluster has its own lil fingerprint, auto-minted, one of a kind, main character energy only. and this command is like "hey, this is your shard's fingerprint, bestie." π«Ά
no guessing, no counting slots, no vibe check needed β the answer just exists, already assigned, ready for you.
π REPLY π
valkey-protocol(7)Bulk string reply: the node's shard ID. π
like a lil string in a bottle. except the bottle is a RESP bulk string and the message is your shard's identity.
β COMPLEXITY β
constant time, babes. it does not scale with your cluster size, it does not care how many nodes you got, it does not stress. one lookup, done, periodt. β‘
π ACL CATEGORIES π
@slow
yes it's filed under slow (the command category, not a judgement on its personality). don't @ me, that's just where it lives. π
π§ HISTORY π§
- Available since: 7.2.0
so it's not ancient, it's not brand new β it's that perfect middle era. vintage enough to be trusted, fresh enough to be iconic. π
π SEE ALSO π
go read these too, they're all in the same friend group fr fr:
asking(3valkey)cluster(3valkey)cluster-addslots(3valkey)cluster-addslotsrange(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-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)
ok quick fyi bestie:cluster-myid(3valkey)gives you the node id, and this page'scluster-myshardidgives you the shard id. they are not the same thing and i need you to internalize that before you go confusing yourself in prod. π
and that's the whole page!! π you now know exactly what shard you belong to, which is honestly more than most people know about themselves. iconic behavior. β¨
this page is from valkey 9.0.0, dated 2025-10-21 β so yeah, fresh-ish, well-loved, and yes i'm aware the command itself showed up in 7.2.0, don't come for me, that's just when the docs got their lil timestamp. anyway. 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