MySQL Error_code: 1756

电话告警故障:MySQL 从库异常宕机。

查看MySQL error日志:

[ERROR] Slave SQL for channel '': ... 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). Error_code: 1756

官网解释:

Waiting for Slave Workers to free pending events
This waiting action occurs when the total size of events being processed by Workers exceeds the size of theslave_pending_jobs_size_max system variable. The 
Coordinator resumes scheduling when the size drops below
this limit. This state occurs only when slave_parallel_workers is set greater than 0. 意思如下: 这个等待状态会在什么时候发生呢?这个状态只会在slave_parallel_workers设置不为0时,当Workers处理的事件总大小超过了系统参数slave_pending_jobs_size_max设置的值。 当大小低于这个值时,调度器才会恢复调度。

查看数据库参数大小:slave_pending_jobs_size_max 默认值为16MB

mysql> show variables like 'slave_pending_jobs_size_max';
+-----------------------------+----------+
| Variable_name               | Value    |
+-----------------------------+----------+
| slave_pending_jobs_size_max | 16777216 |
+-----------------------------+----------+
1 row in set (0.00 sec)

mysql> set global slave_pending_jobs_size_max = 134217728;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'max_allowed_packet';
+--------------------+------------+
| Variable_name      | Value      |
+--------------------+------------+
| max_allowed_packet | 573741824  |
+--------------------+------------+
1 row in set (0.00 sec)

mysql> set global max_allowed_packet = 1073741824;
Query OK, 0 rows affected (0.00 sec)

最后将 slave_pending_jobs_size_max = 128M 写进配置文件中.

posted @ 2024-04-24 18:39  __Yoon  阅读(231)  评论(0编辑  收藏  举报