MySQL Primary master replication

Source: Internet
Author: User

The main master replication of MySQL is two MySQL nodes, mainly from each other. It is very easy to build up MySQL master-slave and then build the main master copy.

Video link: http://www.roncoo.com/course/view/658088f6e77541f5835b61800314083e

On the basis of the original master and slave to do the following operations:

1. Open the Binlog log from the original node

2. The original user who created the read replica from the node

3. In the primary node, point master to the slave node

4. Execute the start slave command on the primary node

The above steps can complete the configuration of the primary master node


Here is a problem to solve, that is, the problem of self-increment primary key, according to the above practice, if you insert data into two nodes, will cause the primary key duplication, here need a small trick

Here let the first node primary key take 1 3 5 7 ... The way to increment the second node is incremented by 2,4,6,8 so that it does not cause a primary key conflict.

auto_increment_increment=2auto_increment_offset=1

In MySQL5.7, you do not need to configure a primary key auto-increment policy, and each library's operations will increment the other library

MySQL Primary master replication

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.