Redis operation and Maintenance

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.