Book Image

MariaDB Cookbook

By : Daniel Bartholomew
Book Image

MariaDB Cookbook

By: Daniel Bartholomew

Overview of this book

Table of Contents (20 chapters)
MariaDB Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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...

  1. 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;
    
  2. Check on the status of our replication slave servers with the following command:

    SHOW ALL SLAVES STATUS\G
    
  3. 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
    
  4. Insert more data into our temp.doctors table on the replication master server, and then run the following SELECT statement on...