650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/88/F4/wKioL1gDGZyiN6xAAADjl_ee0k4112.png-wh_500x0-wm_3 -wmp_4-s_1925814112.png "title=" 4.png "alt=" Wkiol1gdgzyin6xaaadjl_ee0k4112.png-wh_50 "/>
MySQL master-slave synchronization is actually an asynchronous replication process, in order to achieve replication first need to open the Bin-log log on master, the entire process needs to open 3 threads, respectively, the master open IO thread, slave open IO thread and SQL thread.
A) when executing slave startfrom the server, the IO thread from the server connects to master via the authorized user and requests master to send the Bin-log log content after the specified file and location.
b)after the master server receives a request from an IO thread from the slave server, the IO thread on the master server sends the contents of the specified Bin-log log according to the slave server and returns the IO thread to the slave side. (The returned information is in addition to the Bin-log log content, the new Binlog file name on the master server and the next specified update location in Binlog after this time the log content is returned.) )
c) after the slave IO thread receives the information, the received log content is added to the end of the relay-log file on the slave side, and the read to the master side of the The file name and location of the Bin-log are recorded in the Master-info file so that the next time you read it, you will be able to tell master clearly "where I need to start the log content from somewhere in the Bin-log, please send it to me";
d)slave's SQL thread detects new additions to Relay-log and immediately resolves the contents of Relay-log as executable content at the real execution time on the master side and executes on its own.
MySQL Master-slave configuration