关于复制:故障分析-记一次-MySQL-复制故障-Errorcode1317

4次阅读

共计 1496 个字符,预计需要花费 4 分钟才能阅读完成。

作者:侯晓阳

爱可生 DBA 团队成员,次要负责 MySQL 故障解决和 SQL 审核优化。对技术执着,为客户负责。

本文起源:原创投稿

* 爱可生开源社区出品,原创内容未经受权不得随便应用,转载请分割小编并注明起源。

问题背景

MySQL 从库报错如下:

错误信息如下:


...

Last_Errno:1317
Last_Error:Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'a838ba08-c009-11e9-85e1-fa163ea2992d:31622919405' at master log master-bin.005599, end_log_pos 2297. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

...

Last_SQL_Errno:1317
Last_SQL_Error:Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'a838ba08-c009-11e9-85e1-fa163ea2992d:31622919405' at master log master-bin.005599, end_log_pos 2297. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

排查形式

  1. 首先咱们先通过 performance_schema 查看一下造成报错的起因
mysql> select * from performance_schema.replication_applier_status_by_worker;

从这里报错看到,某条语句在回放的时候查问执行被中断了。

  1. 而后咱们再查看 MySQL 的 error-log

日志中也提醒了咱们,因为工作线程被断开,查问中断,它在以后这个地位点进行了,如果想要复原重新启动主从即可。

  1. 尝试重新启动主从
mysql> stop slave;
mysql> start slave;

重启复制通道后,复制的确失常了,接下来须要晓得为什么查问被中断了。

  1. 带着疑难,去看了下在报错的这个工夫里 MySQL 或是服务器做了什么,而后发现了这个工夫 MySQL 在做备份,之后查看 xtrabackup 备份参数是带着 –kill-long-queries-timeout=60 和 –kill-long-query-type=all。

简略来说就是,当 –kill-long-query-type=all,–kill-long-queries-timeout=60,从开始执行 FLUSH TABLES WITH READ LOCK 到 kill 掉阻塞它的这些查问之间期待的秒数为 60 秒,默认值为 0,不会 kill 任何查问,应用这个选项 xtrabackup 须要有 Process 和 super 权限。

  1. 而后查看 xtrabackup 的备份日志,所有答案见了分晓

正文完
 0