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.