MySQL GTIDs
September 18, 2018
Just scratch Notes on GTID with db-deployer:
master [localhost] {msandbox} ((none)) > SET GTID_NEXT='00019024-1111-1111-1111-111111111111:300';
Query OK, 0 rows affected (0.00 sec)
master [localhost] {msandbox} ((none)) > BEGIN;COMMIT;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
master [localhost] {msandbox} ((none)) > SET GTID_NEXT='00019024-1111-1111-1111-111111111111:400';
Query OK, 0 rows affected (0.00 sec)
master [localhost] {msandbox} ((none)) > BEGIN;COMMIT;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
master [localhost] {msandbox} ((none)) > SET GTID_NEXT='AUTOMATIC';
Query OK, 0 rows affected (0.00 sec)
master [localhost] {msandbox} ((none)) > select @@gtid_next;
+-------------+
| @@gtid_next |
+-------------+
| AUTOMATIC |
+-------------+
1 row in set (0.00 sec)
master [localhost] {msandbox} ((none)) > SELECT @@global.gtid_executed;
+----------------------------------------------------+
| @@global.gtid_executed |
+----------------------------------------------------+
| 00019024-1111-1111-1111-111111111111:1-251:300:400 |
+----------------------------------------------------+
1 row in set (0.00 sec)
$ ./test_replication
# master log: mysql-bin.000004 - Position: 66840 - Rows: 20
# Testing slave #1
ok - slave #1 acknowledged reception of transactions from master
ok - slave #1 IO thread is running
ok - slave #1 SQL thread is running
ok - Table t1 found on slave #1
ok - Table t1 has 20 rows on #1
# Testing slave #2
ok - slave #2 acknowledged reception of transactions from master
ok - slave #2 IO thread is running
ok - slave #2 SQL thread is running
ok - Table t1 found on slave #2
ok - Table t1 has 20 rows on #2
# Tests : 10
# failed: 0 ( 0.0%)
# PASSED: 10 (100.0%)
# exit code: 0
$ ./m
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 257
Server version: 5.7.23-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
master [localhost] {msandbox} ((none)) > SELECT @@global.gtid_executed;
+----------------------------------------------------+
| @@global.gtid_executed |
+----------------------------------------------------+
| 00019024-1111-1111-1111-111111111111:1-274:300:400 |
+----------------------------------------------------+
1 row in set (0.00 sec)
master [localhost] {msandbox} ((none)) >