Sinsing analysis of Master-slave replication in Redis

Source: Internet
Author: User

Let's start with a brief introduction to replication in Redis:

(1) The same master can synchronize multiple slave.

(2) Slave can also accept other slaves connection and synchronization request, which can effectively share the sync pressure of master.

(3) master server provides services for slaves in a non-blocking manner, so clients can still submit queries or modify requests during Master-slave synchronization.

(4) Slave server also completes data synchronization in a non-blocking manner. During synchronization, if a client submits a query request, REDIS returns the data before synchronization.

(5) In order to share the master's read operation pressure, the slave server can provide the client with read-only service, and the write service must still be completed by master.

(6) Master can hand-save the data to slaves to complete, thus avoiding the need to have a separate process in master to complete this operation.


How replication works:

After the slave is started and connected to master, it will actively send a sync command. Master will then start the background disk process and collect all the received commands to modify the dataset, and master will transfer the entire database file to slave to complete a full synchronization once the background process has finished executing. The slave server then takes the database file and loads it into memory. After that, Master continues to pass all the modified commands and new modification commands that have been collected to slaves, and slaves will execute the data modification commands at this time to achieve final data synchronization. If there is a disconnection between slave and master, slave can automatically re-practice master, but once the connection is successful, a full synchronization will be performed automatically.


Configuration of replication:

Simply remove the # from the #slaveof <masterip> <masterport> in the configuration file and change it to the appropriate information.






















Sinsing analysis of Master-slave replication in Redis

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.