Principles of Mysql master-slave mode

Source: Internet
Author: User
For the principle of Mysql master-slave mode, refer to the online articles and add your own experiences to understand the role of MYSQL master-slave synchronization (1) Data Distribution (2) Load Balancing (loadbalancing) (3) backup (4) high Availability and fault tolerance? How does MYSQL master-slave synchronization work? Briefly describe the process: the IO thread of the slave server is from the master server

For the principle of Mysql master-slave mode, refer to the online articles and add your own experiences to understand the role of MYSQL master-slave synchronization (1) Data Distribution (2) load balancing (3) backup (4) high availability and fault tolerance? How does MYSQL master-slave synchronization work? Briefly describe the process: the IO thread of the slave server is from the master server

Principles of Mysql master-slave mode

Add your own experiences to the articles on the Internet.

Role of MYSQL master-slave Synchronization

(1) Data Distribution
(2) load balancing)
(3) backup
(4) high availability and fault tolerance

?

Principle of MYSQL master-slave Synchronization

?

Roughly describe the process: Obtain binary logs from the master server from the server's IO thread, save them as relay logs locally, and then execute the relay logs from the top through the SQL thread, so that the slave database is consistent with the master database. The detailed process of master-slave synchronization is as follows:
?
1. The master server verifies the connection.
2. The master server opens a thread for the slave server.
3. The slave server informs the master server of the log offset.
4. The master server checks whether the value is smaller than the offset of the current binary log.
5 .? If the value is smaller than, the slave server is notified to fetch data.
6 .? The slave server continues to fetch data from the master server until the data is obtained. At this time, the slave server thread goes to sleep while the master server thread goes to sleep.
7.When the master server is updated, the master server thread is activated and binary logs are pushed to the slave server.And notifies the slave server thread to enter the working state.
8. Run the binary log from the SQL thread on the server and then go to sleep.

?

Through the above introduction, we can understand why the "YES" status is only available when the Slave_IO and Slave_ SQL processes run normally when the command show slave status \ G is executed from the node, the slave node can synchronize data with the master node.

? Show slave status \ G result display parameters can refer to the official manual http://dev.mysql.com/doc/refman/5.1/en/show-slave-status.html

?

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.