Understanding mysql--Replication (Replication)

Source: Internet
Author: User

1. Replication overview
1.1, Replication solution of the problem data replication technology has the following features: (1) data distribution (2) load balancing (load Balancing) (3) Backup (4) High availability (Hi availability) and fault tolerance
1.2. How replication works from a high level, replication is divided into three steps: (1) Master changes the record to binary log (these are called binary log events, binary logs event), and (2) Slave The MAS The binary log events of ter are copied to its trunk logs (relay log), and (3) the events in the slave log are changed to reflect its own data.

Describes this process:

the master-slave replication principle is explained in detail below :

The first step: the master server logs the data changes to the binary log before each thing that updates the data is completed. Even if things are interleaved during execution, MySQL will also serialize things to the binary log, and after the write is complete, the primary server tells the storage engine to tune things up. The second step: Copy the primary server's binary log from the server to its own hard disk, which is the "Relay log". First, it starts a worker thread, called I/O from the thread. This I/O thread opens a normal client connection and then launches a special binary log storage process (Binlog dump) process. This dump process reads events from the primary server's binary log, and it does not poll things. If it is followed by the primary server, it goes into hibernation and waits for a signal from the primary server when a new event occurs, and the I/O thread writes the event to the relay log from the server. Step three: SQL reads the trunk log from the thread, replays the events in it, and then updates the data from the server. Because this process can keep up with I/O threads, the trunk log is usually in the operating system's cache, with low overhead for all trunk logs. An event that SQL executes from a thread can also be written from the server's own binary log or is not written.

Understanding mysql--Replication (Replication)

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.