MySQL master-slave replication is asynchronous replication
Completed by 3 threads between master and slave
Master I/O--Main Library
Slave I/O--Standby library
Slave SQL--standby library
You must open the Binlog of the main library
1.slave I/O connects to master, starting transfer log from the specified Binlog location (master.info)
2.master I/O received a request to read Binlog sent to slave I/O and returned the following:
(1) Binlog content
(2) The log name of this read to Binlog, location
3.slave I/O writes the above (1) to the relay log end and writes the above (2) to the Master.info, knowing where to proceed with the next copy from the main repository
4.slave SQL detects that relay log is new, parses the converted SQL statement again, and executes it to the main library which binlog log name and location are recorded.
MySQL master-slave replication principle