Slaveof
Slaveof Host Port
The slaveof command is used to dynamically modify the replication (replication) functionality while the Redis is running.
By executing the slaveof host Port command, you can convert the current server to a secondary server (slave server) for the specified server.
If the current server is already a secondary server for a primary server (master server), executing slaveof host port will cause the current server to stop synchronizing the old primary server, discard the old dataset, and start synchronizing the new primary server.
In addition, executing a command on a subordinate server, Slaveof no one, will enable the secondary server to turn off replication and transform it from the subordinate server back to the primary server, and the data set originally synchronized will not be discarded.
With the feature "Slaveof no one does not discard the synchronized data set", the secondary server can be used as the new primary server when the primary server fails, allowing for uninterrupted operation.
Available versions:
= 1.0.0
Complexity of Time:
Slaveof host port, O (n), n is the number of data to be synchronized.
Slaveof NO One, O (1).
return value:
Always return OK.
redis> slaveof 127.0.0.1 6379
Ok
Redis> slaveof NO One
Ok