欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Mysql 1864 主从错误解决方法

程序员文章站 2023-12-19 10:03:52
从字面意思看了一下是因为slave_pending_jobs_size_max默认值为16777216(16mb),但是slave接收到的slave_pending_j...

Mysql 1864 主从错误解决方法

从字面意思看了一下是因为slave_pending_jobs_size_max默认值为16777216(16mb),但是slave接收到的slave_pending_jobs_size_max为17085453(17m);

解决方案

从库执行如下sql

mysql>stop slave;
mysql>set global slave_pending_jobs_size_max=20000000;
mysql> start slave;

#在多线程复制时,在队列中pending的事件所占用的最大内存,默认为16m,如果内存富余,或者延迟较大时,可以适当调大;注意

这个值要比主库的max_allowed_packet大

故障模拟:

从库设置

mysql> set global slave_parallel_workers=4;
mysql> show variables like 'slave_parallel_workers';
+------------------------+-------+
| variable_name | value |
+------------------------+-------+
|slave_parallel_workers | 4 |
+------------------------+-------+
1 row in set (0.00sec)
mysql>set global slave_pending_jobs_size_max=1024;
mysql> show variables like 'slave_pend%';
+-----------------------------+-------+
| variable_name | value |
+-----------------------------+-------+
|slave_pending_jobs_size_max | 1024 |
+-----------------------------+-------+
1 row in set (0.00sec)

主库操作:

mysql> update erp_mkpf set usnam='测试1864错误';
error 1197 (hy000):multi-statement transaction required more than 'max_binlog_cache_size' bytes ofstorage; increase this mysqld variable and try again
mysql> set global max_binlog_cache_size=8388608000000;
query ok, 0 rowsaffected (0.00 sec)
mysql> begin;
query ok, 0 rowsaffected (0.00 sec)
mysql> update erp_mkpf set usnam='测试1864错误';
query ok, 70466 rowsaffected (0.38 sec)
rows matched:70466 changed: 70466 warnings: 0
mysql> commit;
query ok, 0 rowsaffected (0.08 sec)

从库查看状态:

mysql> show slavestatus\g
last_sql_errno: 1864
last_sql_error: cannot scheduleevent update_rows, relay-log name ./he1-relay-bin.000005, position 494 toworker thread because its size 8200 exceeds 1024 ofslave_pending_jobs_size_max.

以上所述是小编给大家介绍的mysql 1864 主从错误解决方法,希望对大家有所帮助

上一篇:

下一篇: