FAQ系列 | 从MySQL 5.6到5.7复制错误解决
来源:互联网 发布:新长征路上的摇滚 知乎 编辑:程序博客网 时间:2024/05/21 14:42
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 直达。
- FAQ系列 | 从MySQL 5.6到5.7复制错误解决
- MySQL 5.6 Replication 复制 FAQ
- [MySQL FAQ]系列 — MySQL复制中slave延迟监控
- 从Oracle复制库到MySQL
- FAQ系列 | 复制线程长时间Opening tables
- Mongodb从0到1系列五: 主从复制
- Mongodb从0到1系列六: 复制集
- C#.NET常见问题(FAQ)-程序如何把窗体文件从从一个项目中复制到另一个项目
- 【FAQ】MySQL解决PacketTooBigException问题
- 解决从vs2010复制汉字粘贴到word乱码问题
- [MySQL FAQ]系列 — 从MyISAM转到InnoDB需要注意什么
- [MySQL FAQ]系列 — 从MyISAM转到InnoDB需要注意什
- 解决 无法将文件“XX”复制到文件“XX”。' <错误>
- mysql 把数据库从一个服务器复制到另一个服务器
- mysql 数据从一个服务器复制到另一个服务器
- 解决mysql使用GTID主从复制错误问题
- mysql高版本5.6到5.5或低版本复制中出现的错误
- FAQ系列 | MySQL DBA修炼秘籍
- ACMUG第三次技术沙龙北京站·6月18活动总结(附ppt下载链接)
- chinapub读书会第10期:机器学习与人工智能 6月25日相约阿里云+优客工场
- 6月18,北京·紫竹院,ACMUG第三次技术沙龙
- 6月18,北京·紫竹院,ACMUG第三次技术沙龙
- 6月18,北京·紫竹院,ACMUG第三次技术沙龙
- FAQ系列 | 从MySQL 5.6到5.7复制错误解决
- FAQ系列 | 数据导入主键冲突问题
- 【Chinapub读书会第9期】5月28日赵鑫磊带你深入解析Linux
- 在线分享《如何针对业务做DB优化》(附PPT、录音、视频地址)
- ACMUG 2016年第一期深圳站·4月16活动总结(附视频地址)
- 5.20 Redis中国用户组成立了,约吗?
- 欢迎使用CSDN-markdown编辑器
- KVM虚拟化实践社区&Ceph中国社区&知数堂 联合在线分享《如何针对业务做DB优化》
- Android--网络请求与json数据解析的使用