The basic process of MySQL replication is as follows:

Source: Internet
Author: User

The basic process of MySQL replication is as follows:

1. The IO thread on the slave connects to the master, and requests the log content after the specified location of the specified log file (or from the beginning of the log;

2. After the master receives a request from the slave Io thread, it reads the log information at the specified location of the specified Log Based on the Request Information and returns it to the slave Io thread. In addition to the information contained in the log, the returned information also includes the name of the binary log file on the master end and its location in the binary log;

3. after the slave Io thread receives the information, it writes the received log content to the end of the relay log file (mysql-relay-bin.xxxxxx) at the slave end in sequence, and record the file name and location of the bin-log on the master end to the master-info file, so that the next read can clearly show the High-Speed Master "I need to start from the location of a bin-log, please send it to me"

4. after the slave SQL thread detects the newly added content in the relay log, it will immediately parse the content in the log file into the executable query statements during actual execution on the master end, and execute these queries on your own. In this way, the same query is actually executed on the master and slave ends, so the data at both ends is exactly the same.

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.