For small databases, we can use the mysqldump full-Library export import directly to create from the library.
Test environment:
CentOS6.8 x86_64
MySQL5.6.34 Community RPM Edition
Main Library: Node0 192.168.2.10
From library: Node1 192.168.2.11
5.6 The parameters that must be accompanied by the Gtid copy (both the main and slave libraries are added with these 3 rows of parameters):
Gtid-mode=on
Enforce_gtid_consistency = On
Log_slave_updates=on
STEP1, export in main library and SCP to Node1:
mysqldump-uroot [email protected]-a-q--single-transaction--master-data=2 >/root/all.sql
Scp/root/all.sql node1:/root/
Step2, Node1 on the back:
Node1 New installation without password, execute MySQL to log in
Source/root/all.sql;
Step3, start replication on Node1:
Change MASTER to master_host= ' 192.168.2.10 ',
Master_user= ' RPL ',
Master_password= ' RPL ',
master_port=3306,
Master_auto_position=1;
Start slave;
Show Slave Status\g
Description
Mysqldump this way of importing does not need to execute set global gtid_purged= ' xxxxx ' like innobackup; This type of operation. Because there are automatic settings in the mysqldump exported SQL, this is the part of the exported all.sql:
Beijing website Construction
Mysqldump creating a Gtid-based slave library