MySQL Master-slave configuration

Source: Internet
Author: User

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.

    1. 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.

    2. 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.) )

    3. 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";

    4. 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

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.