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)