Home  >  Article  >  Database  >  What are the replication principles and processes of MySQL?

What are the replication principles and processes of MySQL?

藏色散人
藏色散人Original
2018-09-06 17:37:462145browse

This article mainly introduces you to the negative value principle and process of MySQL. [Recommended reference MySQL video tutorial or MySQL manual]

What are the replication principles and processes of MySQL?

##1. Execute the sart slave command on the Slave server to start the master-slave Replication switch starts master-slave replication.

2. At this time, the IO thread of the Slave server will request to connect to the master server through the copy user permissions that have been authorized on the master, and request to execute the binlog log file from the specified location (the log file name and location are configured in When the master-slave replication service is executed, the binlog log content will be sent after executing the change master command)

3. After the Master server receives the request from the IO thread of the Slave server, the binary dump IO thread will be based on the Slave server's request. The information requested by the IO thread reads the binlog log information after the specified location of the specified binlog log file in batches, and then returns it to the IO thread on the Slave side. In addition to the binlog log content, the returned information also includes the new binlog file name recorded on the master server, and the next specified update position in the new binlog.

4. When the IO thread of the Slave server obtains the log content, log files and location points sent by the IO thread on the Master server, it will write the binlog log content to the Slave side's own Relay Log (ie. log) file (MySQL-relay-bin.xxx), and record the new binlog file name and location into the master-info file, so that the next time the new binlog log on the master side is read, the Master server can be told to start the new binlog. Start reading the new binlog log content from the specified file and location of the log

5. The SQL thread on the Slave server will detect the local Relay in real time Log content added by the IO thread in Log, and then put Relay in time The content in the LOG file is parsed into sql statements, and such sql statements are executed on the own Slave server in the order in which the SQL statements are parsed, and the file name and location of the current application relay log are recorded in relay-log.info


The above is the detailed content of What are the replication principles and processes of MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn