日志:
150410 13:17:41 [ERROR] Error reading packet from server: File '/var/lib/mysql/mysql-bin.006150' not found (Errcode: 13) ( server_errno=29)
150410 13:17:41 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.006150' at position 30041150410 13:17:41 [ERROR] Error reading packet from server: File '/var/lib/mysql/mysql-bin.006150' not found (Errcode: 13) ( server_errno=29)
150410 13:18:41 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.006150' at position 30041
解决方法 : 将主库的备份文件 mysql-bin.00615 以及之后的 还原到 主服务器 /var/lib/mysql/ 注意修改拥有人为 mysql:mysql 否则会报错:
150410 13:09:58 [ERROR] Failed to open log (file '/var/lib/mysql/mysql-bin.006150', errno 2)
通过查看 系统日志 和 mysql 的日志 推测从服mysql 不同步的原因可能是 重启防火墙, 从服宕的时间跟从其防火墙的时间差几秒。。
未测试:
修改主从服务器的 max_allowed_packet 参数
主从服务器默认为1M,可根据实际情况修改其大小。
mysql> show variables like 'max_allowed_packet';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1047552 |
+--------------------+---------+
1 row in set (0.00 sec)
mysql> SET @@global.max_allowed_packet=16777216;
Query OK, 0 rows affected (0.01 sec)