mysql 主从错误

复制错误

    错误1:

     Last_IO_Errno: 1159 (ER_NET_READ_INTERRUPTED)

     Last_IO_Error: The slave I/O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master. Error: 

     错误2:     

    Last_IO_Errno: 1593 (ER_SLAVE_FATAL_ERROR)

    Last_IO_Error: The slave I/O thread stops because SET @master_heartbeat_period on master failed. Error: 

 

分析

 1 首先从告警信息,同一主机出现大量实例的复制错误。首先可以排出是mysql问题。应该是外部环境导致,例如网络,硬件故障等。

 2 错误1159即ER_NET_READ_INTERRUPTED网络中断,由此可以推断是网络问题导致

 3 从错误信息中,Last_IO_Error: The slave I/O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master。定位源码可看到,IO thread每次启动io_thread从主库拉binlog是都有以下逻辑,(handle_slave_io-> get_master_version_and_clock)检查serverid是否重复,时间钟,时区,字符集,设置master heartbeat等. 此错误是在检查serverid时发生网路中断所致。

  类似的错误还有:

   Get master TIME_ZONE failed with error:xxx

 

处理方法

    stop slave;start slave; 即可恢复 

 

posted @ 2017-09-13 17:13  行知散人  阅读(680)  评论(0编辑  收藏  举报