mysql由于server-id相同而造成同步失败
原创
©著作权归作者所有:来自51CTO博客作者lynnteng0的原创作品,请联系作者获取转载授权,否则将追究法律责任
背景:有3台服务器,做了1主2从
主:192.168.0.2
从:192.168.0.9/192.168.0.6
先从同好0.6的数据,再启动0.9,同步数据时候,Seconds_Behind_Master的值一直保持某个数值,日志里面产生了几万个localhost-relay-bin.*的文件,日志报如下错误:
121101 11:38:52 [Note] Slave: received end packet from server, apparent master shutdown:
121101 11:38:52 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000002' at postion 188278072
121101 11:38:52 [Note] Slave: received end packet from server, apparent master shutdown:
121101 11:38:52 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000002' at postion 188279159
121101 11:38:52 [Note] Slave: received end packet from server, apparent master shutdown:
121101 11:38:52 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000002' at postion 188279159
121101 11:38:52 [Note] Slave: received end packet from server, apparent master shutdown:
121101 11:38:52 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000002' at postion 188280253
从网上搜索,是说由于server-id相同而造成的。因为搭建环境之后,/etc/my.cnf是直接从0.6上面复制过来的
解决方法:
修改0.9上面的server-id=3,停数据库,把datadir里面的日志全部删除,重启数据库,重新同步,OK
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
MySQL主从同步延迟解决
mysql主从同步延迟解决
MySQL 主从同步 mysql主从同步 -
记录flink sql实时同步mysql数据表到mysql
关于大数据实时数据同步flink部分测试实验
flink mysql bc -
master/slave 相同server_id引起的同步失败
master/slave 相同server_id引起的同步失败
master slave 相同 serve