站长网 MySql教程 MySQL 5.6 GTID寻常错误的示例分析

MySQL 5.6 GTID寻常错误的示例分析

这篇文章给大家分享的是有关MySQL 5.6 GTID常见错误的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。 在测试环境搭建完基于GTID的双主环境后,启动数据库报错: [root@localhost ~]# service mysqld start Starting

这篇文章给大家分享的是有关MySQL 5.6 GTID常见错误的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
 
在测试环境搭建完基于GTID的双主环境后,启动数据库报错:
 
[root@localhost ~]# service mysqld start
Starting MySQL………The server quit without updating PID[FAILED]usr/local/mysql/data/localhost.pid).
 
 
查看错误日志/var/log/mysqld.log,发现有如下信息:
 
2017-05-11 09:08:38 56355 [Note] Audit Plugin: Init completed successfully.
2017-05-11 09:08:38 56355 [ERROR] –gtid-mode=ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires –log-bin and –log-slave-updates
2017-05-11 09:08:38 56355 [ERROR] Aborting
 
 
说明如下:
gtid_mode=ON,log_slave_updates,enforce_gtid_consistency这三个参数一定要同时在my.cnf中配置。否则在mysql.err中会出现如下的报错
 
 
2015-02-26 17:11:08 32147 [ERROR] –gtid-mode=ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires –log-bin and –log-slave-updates
 
 
2015-02-26 17:13:53 32570 [ERROR] –gtid-mode=ON or UPGRADE_STEP_1 requires –enforce-gtid-consistency
 
 
修改/etc/my.cnf,加入以下内容:
gtid-mode = on
log-slave-updates=ON
enforce-gtid-consistency=ON
 
 
再次启动数据库后,再无报错:
 
 
[root@localhost ~]# service mysqld start
Starting MySQL…..                                        [  OK  ]
 
 
 
 
[root@localhost ~]# mysql -u mdba -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.27-log Source distribution
 
 
Copyright (c) 2000, 2015, 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.
 
 
查看gtid模式:
 
 
mysql> show global variables like '%gtid%';
+———————————+——-+
| Variable_name                   | Value |
+———————————+——-+
| binlog_gtid_simple_recovery     | OFF   |
| enforce_gtid_consistency        | ON    |
| gtid_executed                   |       |
| gtid_mode                       | ON    |
| gtid_owned                      |       |
| gtid_purged                     |       |
| simplified_binlog_gtid_recovery | OFF   |
+———————————+——-+
7 rows in set (0.00 sec)
 
GTID相关参数
参数                     comment
gtid_executed           执行过的所有GTID
gtid_purged           丢弃掉的GTID
gtid_mode           gtid模式
gtid_next           session级别的变量,下一个gtid
gtid_owned           正在运行的gtid
enforce_gtid_consistency    保证GTID安全的参数
 
 
GTID复制的限制:
GTID 模式实例和非GTID模式实例是不能进行复制的,要求非常严格,要么都是GTID,要么都不是
gtid_mode 是只读的,要改变状态必须1)关闭实例、2)修改配置文件、3) 重启实例
在同一事务中更新事务表与非事务表将导致多个GTIDs分配给同一事务
无法使用CREATE TABLE … SELECT statements语句
无法在事务中对非事务存储引擎进行更新
无法在事务中使用CREATE TEMPORARY TABLE
 
感谢各位的阅读!

本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/jc/mysql/2021/1223/42366.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部