SLAVEOF

Since 1.1.0ServerChanged in 1.2.1

Syntax

SLAVEOF host port | NO ONE
  • Flags: admin
  • ACL categories: @admin, @dangerous, @slow
  • Arity: 3

History

  • 1.2.1: acl categories: removed server

Another name for REPLICAOF, with the same arguments and replies, kept for clients and scripts written before Redis renamed it. SLAVEOF host port makes the server a replica of that master, dropping its own data for the master's; SLAVEOF NO ONE makes it a master again, keeping the data it has.

New code should use REPLICAOF. Replication explains setting up and promoting replicas.

Examples

> SLAVEOF 127.0.0.1 6380
OK
> ROLE
1) "slave"
2) "127.0.0.1"
3) (integer) 6380
4) "connected"
5) (integer) 14
> SLAVEOF NO ONE
OK