"Go" MySQL database master-Slave synchronization management

Source: Internet
Author: User

MySQL master-Slave synchronization architecture is currently one of the most used database architecture, especially the load is relatively large site, so for master-slave synchronization management is very important, novice often in the case of master-slave synchronization errors do not know how to start, This article is a detailed description of MySQL master-slave management according to its own experience.

The role of MySQL master-slave synchronization

(1) Data distribution

(2) Load balancing (load Balancing)

(3) Backup

(4) High availability (Hi availability) and fault tolerance

The principle of MySQL master-slave synchronization

The main thing about MySQL's master-slave synchronization is to understand how MySQL's master-slave synchronization works, that is, the principle of master-slave synchronization, through the process that can clearly guide its work:

Describe the process roughly: from the server's IO thread, get the binary log from the primary server, save it locally as a trunk log, and then execute the contents of the relay log from the top through the SQL thread to keep it consistent from the library and the main library. The detailed process of master-slave synchronization is as follows:

    1. The primary server verifies the connection.
    2. The primary server opens a thread from the server.
    3. The offset shift from the primary server log is told to the primary server from the server.
    4. The primary server checks to see if the value is less than the current binary log bias shift.
    5. If it is less than, the notification is to fetch data from the server.
    6. From the server continues to fetch data from the primary server until it is finished, when the server thread goes to sleep, the primary server thread goes to sleep at the same time.
    7. When the primary server has an update, the primary server thread is activated, and the binary log is pushed to the slave server, and the server thread is notified to enter the working state.
    8. Executes the binary log from the server SQL thread and then goes to sleep.

Original link:http://blog.chinaunix.net/uid-20639775-id-3254611.html

Http://www.cnblogs.com/binyue/p/3850895.html

"Go" MySQL database master-Slave synchronization management

Related Article

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.