大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
4个基本函数
鱼峰ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!1. GTID_SUBSET(set1,set2)- 若在set1中的GTID,也在set2中,返回true,否则返回false(set1是set2的子集)。
[root@mysql.sock][(none)]> SELECT GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:23','3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57');
+-----------------------------------------------------------------------------------------------------+
| GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:23','3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57') |
+-----------------------------------------------------------------------------------------------------+
| 1 |
+-----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
[root@mysql.sock][(none)]> SELECT GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25','3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57');
+--------------------------------------------------------------------------------------------------------+
| GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25','3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57') |
+--------------------------------------------------------------------------------------------------------+
| 0 |
+--------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
2. GTID_SUBTRACT(set1,set2) - 返回在set1中,不在set2中的GTID集合(set1和set2的差集)。
[root@mysql.sock][(none)]> SELECT GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57','3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25');
+----------------------------------------------------------------------------------------------------------+
| GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57','3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25') |
+----------------------------------------------------------------------------------------------------------+
| 3e11fa47-71ca-11e1-9e33-c80aa9429562:26-57 |
+----------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
[root@mysql.sock][(none)]> SELECT GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57','3E11FA47-71CA-11E1-9E33-C80AA9429562:23-24');
+----------------------------------------------------------------------------------------------------------+
| GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57','3E11FA47-71CA-11E1-9E33-C80AA9429562:23-24') |
+----------------------------------------------------------------------------------------------------------+
| 3e11fa47-71ca-11e1-9e33-c80aa9429562:21-22:25-57 |
+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
3. WAIT_FOR_EXECUTED_GTID_SET(gtid_set[, timeout]) - 等待gtid_set执行完,即GTID_SUBSET(gtid_subset, @@GLOBAL.gtid_executed)成立。timeout是可选的,超时参数。函数返回0,代表成功;返回1,代表超时;返回其它值,代表出错。
[root@mysql.sock][(none)]> SELECT WAIT_FOR_EXECUTED_GTID_SET('c4e5d4a0-a9be-11e9-b444-080027f22add:1-5',5);
+--------------------------------------------------------------------------+
| WAIT_FOR_EXECUTED_GTID_SET('c4e5d4a0-a9be-11e9-b444-080027f22add:1-5',5) |
+--------------------------------------------------------------------------+
| 0 |
+--------------------------------------------------------------------------+
1 row in set (0.00 sec)
4. WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(gtid_set[, timeout][,channel]) - 和WAIT_FOR_EXECUTED_GTID_SET()类似,多了channel参数。
使用场景
1. 检查slave节点上是否执行了master上的所有GTIDs。
在salve节点上执行,SELECT GTID_SUBSET(master_gtid_executed, slave_gtid_executed),若返回0,说明slave节点上还有GTIDs未执行。
在slave节点上执行,SELECT GTID_SUBTRACT(master_gtid_executed, slave_gtid_executed),若返回GTIDs,也说明slave节点上还有GTIDs未执行。
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。