REPLICAOF(3valkey)

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

πŸ’– REPLICAOF πŸ’–

okay bestie, welcome to the valkey command manual, section 3valkey β€” this is the page for REPLICAOF, and it's literally the glow-up button for your replication setup. sit down, hydrate, let's go 🫢


✨ NAME ✨

replicaof β€” sets a server up as a replica of another one, or promotes it to be a primary. it's giving "makeover, but for your topology" πŸ’…


✨ SYNOPSIS ✨

REPLICAOF host port
REPLICAOF NO ONE

✨ DESCRIPTION ✨

so. the REPLICAOF command can flip the replication settings of a replica on the fly. no restart, no drama, no cap. πŸ”₯

if a Valkey server is already out here living its replica life, then REPLICAOF NO ONE turns off replication entirely and makes that Valkey server into a PRIMARY. main character promotion, fr fr πŸ‘‘. and in its proper form, REPLICAOF hostname port makes the server a replica of another server that's listening at the hostname and port you specified. iconic.

if a server is already a replica of some primary, then REPLICAOF hostname port will stop the replication against the old server and start the synchronization against the new one β€” and it discards the old dataset while doing it. 🫣 yes, that's a real thing, that's not me being dramatic.

bestie listen. the REPLICAOF NO ONE form stops replication and turns the server into a MASTER, but it will not discard the replication. that's the key difference, don't sleep on it.

so like, here's the whole vibe: if the old primary stops working, you can turn the replica into a primary and point the application at this new primary in read/write. and then later, when the other Valkey server gets fixed, it can be reconfigured to work as a replica. full circle, we love a redemption arc 🌈


✨ REPLY ✨

valkey-protocol(7) Simple string reply: OK. that's it, that's the reply, she's simple and she's perfect πŸŽ€


✨ COMPLEXITY ✨

O(1) β€” constant time, baby. fast fast. ⭐


✨ ACL CATEGORIES ✨

  • @admin
  • @dangerous
  • @slow

(dangerous AND slow, so yeah, she's highkey a lot 😭 handle with care, she's worth it tho)


✨ HISTORY ✨

  • Available since: 5.0.0

✨ EXAMPLES ✨

> REPLICAOF NO ONE
"OK"

> REPLICAOF 127.0.0.1 6799
"OK"

✨ SEE ALSO ✨

the whole friend group, no one gets left out πŸ’œ


okay that's the whole page bestie, you ate that πŸ’… this was Valkey 9.0.0, dated 2025-10-21, and that's the REPLICAOF(3valkey) energy. now go forth and replicate responsibly πŸ¦‹βœ¨πŸŒΈ

πŸ“¦ where this page comes from