zoukankan      html  css  js  c++  java
  • 【MySQL故障处理】 Seconds_Behind_Master= NULL Error_code: 1197

    版本:mysql 5.6.32
    错误描述:

    Error_code: 1197
    Last_Error: Worker 3 failed executing transaction '352aa3e8-5573-11e6-8010-1866da5c62e5:184599297' at master log mysql-bin.000474,
    end_log_pos 13934385; Could not execute Update_rows event on table pay_0003.order_entity_0054; Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storag
    e; increase this mysqld variable and try again, Error_code: 1197; handler error HA_ERR_RBR_LOGGING_FAILED; the event's master log mysql-bin.000474, end_log_pos 13934385, Error_code: 1197
    

    处理过程:
    根据报错信息,知道是max_binlog_cache_size小了,

    解决办法
    临时增加该值后restart slave即可以继续复制线程。

    mysql> stop slave;
    mysql> set global max_binlog_cache_size=201326592;
    mysql> start slave;
    

    关于max_binlog_cache_size请看这里:

    如果一个事务需要多于设置值的内存,就会报上面的错。最小4096字节,最大支持4GB(4294967296字节),因为binlog位置点最大4GB,支持动态修改。

    解决了问题,继续查找发生问题的原因,生产环境中的该参数设置为64M,当一个事务影响的数据量超过该值时,即会报错。

    执行的sql为
    insert into table1 select*from table2 where time>'2016-10-01'
    形式的多语句事务,查看binlog文件的大小,最大的超过了200M(max_binlog_size设置为50M)。

    因此是大事务造成的,大事务还容易造成主从延时的问题,推荐将大事务拆分为小事务执行

  • 相关阅读:
    基于Java的地铁线路查询系统设计思路
    个人总结05
    构建之法读书笔记03
    Java 8 (二) 新的时间API
    MySql基础笔记(三)其他重要的事情
    MySql基础笔记(二)Mysql语句优化---索引
    JavaScript基础笔记(十四)最佳实践
    JavaScript基础笔记(十三)测试和调试
    MySql基础笔记(一)Mysql快速入门
    JavaScript基础笔记(十二)Ajax
  • 原文地址:https://www.cnblogs.com/icyblog/p/7200829.html
Copyright © 2011-2022 走看看