牛刀小试MySQL--GTID

GTID的概念

何为GITD

GTID(global transaction identifier)是全局事务标识符,在MySQL5.6版本中作为一个超级特性被推出。事务标识不仅对于Master(起源)的服务器来说是惟一的,而且在整个复制拓扑架构来说,也是全局唯一的。

1.GTID的格式

GTID = source_id:transaction_id

GTID分为两部分,source_id和transaction_id。source_id是通过使用MySQL服务的server_uuid来表示 。transaction_id 是在事务提交的时候由系统顺序分配的一个序列号。

使用show master status查看当前实例执行过的GTID事务信息。如下:

(root@localhost) [Ztest]> show master status\G;
*************************** 1. row ***************************
             File: mysql-bin.000005
         Position: 1959
     Binlog_Do_DB: 
Binlog_Ignore_DB: 
Executed_Gtid_Set: 4160e9b3-58d9-11e8-b174-005056af6f24:1-10
1 row in set (0.00 sec)
    可以看出,本实例的source_id为4160e9b3-58d9-11e8-b174-005056af6f24,transaction_id为1-10,说明是提交了10个事务。

MySQL数据库服务的uuid的查询方式。

(root@localhost) [(none)]>  show GLOBAL VARIABLES like 'server_uuid';
+---------------+--------------------------------------+
| Variable_name | Value                                |
+---------------+--------------------------------------+
| server_uuid   | 4160e9b3-58d9-11e8-b174-005056af6f24 |
+---------------+--------------------------------------+
1 row in set (0.02 sec)

猜你喜欢

转载自www.cnblogs.com/zhangshengdong/p/9171643.html