MySQL Knowledge one day Harvest (1215)

Source: Internet
Author: User
Tags unique id uuid

Mysql Gtid Master-Slave copy Construction

A Brief introduction

mysql5.6 after each MySQL server has a globally unique ID number called UUID, universal Unique identification code (universally unique Identifier), The Gtid is made up of the current node's UUID (a 128-bit random number) and the random number (TID) generated for the current node, so as long as the UUID is different, the transaction ID is guaranteed to be different on this basis.

The mainstream production environment is the replication of binglog rows and Gtid.

Two simple construction process

1 adding parameters to the configuration file (the default Binlog log is turned on)

Gtid_mode = on open Gtid mode
Enforce_gtid_consistency = 1 Mandatory gtid consistency
log_slave_updates = 1 slave update is logged

2 Creating a user

GRANT REPLICATION SLAVE on * * to ' backup ' @ ' percent ' identified by ' 123456 ';
Flush privileges;
3 Export the main library backup (for small libraries)

/usr/local/mysql/bin/mysqldump-s/usr/local/mysql/tmp/mysql3306.sock--master-data=2--single-transaction-a > 1. Sql

--master-data=2 record the location of the binary log at the time of the backup and comment out

--single-transaction-a a snapshot for InnoDB but MyISAM still locks the table.

4 Import Primary library backup to Slave library

5 Synchronizing

Change Master to master_host= ' 127.0.0.1 ', master_port =3306,master_user= ' backup ', master_password= ' 123456 ', master_ Auto_position=1;

Master_auto_position=1 This option is for the Gtid feature to automatically find Binlog files and locations based on Gtid

6 open and view from library status

Slave start
Show Slave Status\g

There are questions to build the success of the message

This article is from the "Detailed introduction of Oracle Lock" blog, declined reprint!

MySQL Knowledge one day Harvest (1215)

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.