SLAVEOF(3valkey)

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

πŸ’… SLAVEOF β€” the valkey command manual, bestie edition

okay so we're reading the Valkey Command Manual today and the command on the docket is SLAVEOF. buckle up πŸŽ€


✨ NAME ✨

slaveof β€” sets a server as a replica of another one, or promotes it to being a primary. that's it. that's the whole job. πŸ‘‘


🌸 SYNOPSIS 🌸

SLAVEOF host port
SLAVEOF NO ONE

two forms. that's the whole menu. pick your fighter. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay bestie first things first, a little note about the word slave used in this man page and in the command name: if it weren't for backward compatibility, the Valkey project no longer uses the words β€œmaster” and β€œslave”. please use the new command REPLICAOF instead. the command SLAVEOF will keep working though, for backward compatibility. so like. it's giving legacy. πŸ™ˆ

now the actual tea. the SLAVEOF command can change the replication settings of a replica on the fly. no restart, no drama, no notes.

  • if a Valkey server is already acting as a replica, the command SLAVEOF NO ONE will turn off the replication, turning the Valkey server into a MASTER. glow up fr. ✨
  • in the proper form, SLAVEOF hostname port will make the server a replica of another server listening at the specified hostname and port.

if a server is already a replica of some primary, SLAVEOF hostname port will stop the replication against the old server and start the synchronization against the new one, discarding the old dataset. yeah. gone. the old data does not get to come with you. πŸ’€

the form SLAVEOF NO ONE will stop replication, turning the server into a MASTER, but will not discard the replication. so if the old primary stops working, it's possible to turn the replica into a primary and set the application to use this new primary in read/write. later, when the other Valkey server is fixed, it can be reconfigured to work as a replica. it's giving main character energy, honestly. πŸ‘‘


πŸ’– REPLY πŸ’–

valkey-protocol(7) Simple string reply: OK. short. sweet. iconic. 🫢


⭐ COMPLEXITY ⭐

O(1) β€” constant time, no cap, we love a low-effort baddie. 🌈


πŸŽ€ ACL CATEGORIES πŸŽ€

@admin @dangerous @slow

(three categories, and yes @dangerous is right there, bestie, this command rewrites your entire replication setup, be normal about it. 😭)


πŸ‘‘ HISTORY πŸ‘‘

  • Available since: 1.0.0

ancient. a legend. a founding mother. πŸ’œ


πŸ”₯ NOTES πŸ”₯

This command is deprecated (since 5.0.0) and replaced by REPLICAOF.

so like… it works, it's fine, but it's the old one. use the new one. iykyk. πŸ’…


🌈 SEE ALSO 🌈

okay this list is long, but every single one is here because every single one matters:


and that's the whole page, bestie πŸ“ this was Valkey 9.0.0, dated 2025-10-21, and it ate. go forth and REPLICAOF instead, mwah πŸ’–πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from