Using global transaction IDs
Global Transaction ID (GTID) is a new feature in MariaDB 10.0 and above. It helps us achieve greater reliability and flexibility with our replication.
Getting ready
This recipe builds upon the previous one, so to get ready for this recipe, simply set up a basic replication as described in the Setting up replication recipe.
How to do it...
On both our replication slave servers, launch the
mysql
command-line client and run the following commands:STOP SLAVE; CHANGE MASTER TO MASTER_USE_GTID = SLAVE_POS; START SLAVE;
Check on the status of our replication slave servers with the following command:
SHOW ALL SLAVES STATUS\G
Look at the bottom of the output for the following lines (the
Gtid_Slave_Pos
value will likely be different and the lines are separated by several other lines in the output):Using_Gtid: Slave_Pos Gtid_Slave_Pos: 0-101-2320
Insert more data into our
temp.doctors
table on the replication master server, and then run the followingSELECT
statement on...