MySQL master-slave replication Simple implementation

Source: Internet
Author: User
Tags log mysql version

In MySQL replication, relative to the main master replication, master-slave architecture of better stability, and the main owners will always have some problems, it is not recommended. Master-slave replication based on read-write separation is recommended in large architectures

This article does not involve the content of read-write separation, but simply realizes the master-slave copy of MySQL. The whole process of understanding the principle of replication is very simple, so the first simple introduction of the principle.

The fundamentals of MySQL's master-slave replication:

On the primary server, the binary log is sent to the server, the received relay log is read from the server, the SQL statements in the log are executed, and data synchronization is achieved.

The entire implementation process is shown in the following illustration, and it is easy to see the whole process through the picture

For the master and slave between the use of asynchronous transmission or synchronous transmission, specific look at the network situation and the overall structure of the

Note that for compatibility issues, Master's MySQL version is lower or the same than the slave version between the master and the server.

If you are deploying a standby server on a primary server that already has data, to back up the primary server's data, make a copy of the binary log location record at the time of the backup, and then revert to the server and specify the replication location from the server's binary log from the primary server, starting at the Point-in-time.

Implementation process

First of all, install MySQL on 2 servers. Installation steps are no longer listed, I am using the green version of the installation, the MySQL configuration of both sides the best

Modify My.cnf,master Modify Server-id for 1,slaver modify Server-id is greater than 1 of the number

Master

Slave

Turn off binary logs from the server to avoid high IO on the server and open Relay-log

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.