FAQ系列 | 从MySQL 5.6到5.7复制错误解决
2016-06-02 15:28
519 查看
0、导读
在MySQL 5.7下采用多源复制方式,从5.6复制数据过来,会有问题吗?1、问题描述
Q群里有位朋友想尝鲜5.7的多源复制,于是用MySQL 5.7版本作为slave,把MySQL 5.6作为master,想要将数据进行汇总,发现此路不通。他在my.cnf中设置了2个选项,开启并发复制:
slave_parallel_type = LOGICAL_CLOCK
slave_parallel_workers = 4
启动复制线程后,结果在错误日志中不断有类似下面的信息:
Transaction is tagged with inconsistent logical timestamps: sequence_number (823267087) <= last_committed (1301275374434324336)
执行 SHOW SLAVE STATUS\G 查看状态:
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
...
Last_Errno: 1756
Last_Error: ... The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state. A restart should restore consistency automatically, although using non-transactional storage for data or info tables or DDL queries could lead to problems. In such cases you have to examine your data (see documentation for details).
...
Last_SQL_Errno: 1756
Last_SQL_Error: ... The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state. A restart should restore consistency automatically, although using non-transactional storage for data or info tables or DDL queries could lead to problems. In such cases you have to examine your data (see documentation for details).
...
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp: 160523 18:49:05
...
*************************** 2. row ***************************
Slave_IO_State: Waiting for master to send event
...
Last_Errno: 1756
Last_Error: ... The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state. A restart should restore consistency automatically, although using non-transactional storage for data or info tables or DDL queries could lead to problems. In such cases you have to examine your data (see documentation for details).
Skip_Counter: 0
...
Last_SQL_Errno: 1756
Last_SQL_Error: ... The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state. A restart should restore consistency automatically, although using non-transactional storage for data or info tables or DDL queries could lead to problems. In such cases you have to examine your data (see documentation for details).
...
2、原因分析
上面这些错误提示可以看到,主要原因是:slave端采用了基于 LOGICAL_CLOCK 类型的并行复制,但master端的binlog格式并不支持这种方式,所以slave端无法正确读取binlog并行apply。3、解决方案
虽然仍旧可以采用MySQL 5.7作为slave,但就无法开启基于 LOGICAL_CLOCK 类型的并行复制了。需要改回传统模式就可以了:slave_parallel_type = DATABASE
此外,在MySQL复制方案中,强烈建议不要让主从大版本不一样,很容易出现各种各样的问题。
关于MySQL的方方面面大家想了解什么,可以直接留言回复,我会从中选择一些热门话题进行分享。 同时希望大家多多转发,多一些阅读量是老叶继续努力分享的绝佳助力,谢谢大家 :)
广告时间:离开北京的理由很多,老家这口茶算一个 老叶自营 正味安溪铁观音,特别适合IT同行。特别功效:健康减肥好身体,提神醒脑不易误操作。识别下方二维码或访问 yejinrong.com 直达。
相关文章推荐
- Mysql Grant 用户权限总结(详细编)
- Mysql 学习笔记
- Mysql两种安装方式比较
- mysql基础(二)
- mysql 执行计划走索引
- mysql 执行计划走索引
- mysql 执行计划走索引
- 23个MySQL常用查询语句
- 总结mysql服务器查询慢原因与解决方法
- MYSQL 5.7.12 ZIP 版本 windows安装步骤
- mysql删除重复数据
- 使用nagios监控被监控主机上的应用服务mysql数据库 (一)
- mysql 存储过程 -- 游标的使用(备忘)
- mysql 存储过程 -- 游标的使用(备忘)
- windows下mysql的备份批处理
- MySQL5.7.12 Windows zip配置启动
- mysql表空间被占用,同名表无法创建或导入
- MySQL索引的创建、删除和查看
- mysql导入sql执行出现中文乱码解决方法
- 文章标题mysql 命令小记