Latest web development tutorials

Redis Slaveof command

Redis server

Redis Slaveof command to specify the current server into a slave server server (slave server).

If the current server is already a master server (master server) slave servers, then execute SLAVEOF host port will cause the server to stop the current old primary server synchronization, discard old data set and began to synchronize the new primary server.

In addition, a slave server Run SLAVEOF NO ONE will enable the slave server replication closed, and the transition from slave servers back to the main server, to synchronize data obtained from the original set is not dropped.

Use "SLAVEOF NO ONE does not drop resulting datasets synchronize" this feature, you can master server fails, the slave server as the new master server, enabling continuous operation.

grammar

redis Slaveof basic command syntax is as follows:

redis 127.0.0.1:6379> SLAVEOF host port  

Available versions

> = 1.0.0

return value

Always returns OK.

Examples

redis 127.0.0.1:6379> SLAVEOF 127.0.0.1 6379
OK

redis 127.0.0.1:6379> SLAVEOF NO ONE
OK

Redis server