mysql> show master status;
+------------------+----------+--------------+------------------+------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------+
| mysql-bin.000004 | 573 | | | 531fa6d1-627f-11e9-8dc7-000c297887a1:1-2 |
+------------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)
mysql>
将slave中log_slave_updates关掉,就能看到mysql.gtid_executed表中记录已执行gtid信息了
mysql> select * from mysql.gtid_executed;
+--------------------------------------+----------------+--------------+
| source_uuid | interval_start | interval_end |
+--------------------------------------+----------------+--------------+
| 531fa6d1-627f-11e9-8dc7-000c297887a1 | 1 | 2 |
| 531fa6d1-627f-11e9-8dc7-000c297887a1 | 3 | 3 |
+--------------------------------------+----------------+--------------+
2 rows in set (0.00 sec)
由于是基于事务的,所以就有了限制条件: create table select的方式在基于行复制的情况下会被拆分为创建表和insert数据两个事件,某些情况下这两个事件会被分配相同GTID导致后面insert数据部分被忽略而产生错误; 一个事务中既包含InnoDB表又包含MyISAM表会导致可能产生多个gtid,或者表在主从库中存储引擎不一致都会产生gtid复制异常
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx