【MySQL故障处理】Seconds_Behind_Master=NULL Error_code: 1197

  


将处理主从故障的过程记录在此:

<李>

故障1,Error_code: 1197 (max_binlog_cache_size)

数据库版本:5.7.9

报错信息:

(错误),Slave  SQL  for  channel ”:   Worker  1, failed  executing  transaction “bea4612c - 4828 - 11 - e7 - 90 - b3 - a0423f31cad6:716212’, at  master  log  mysql.135371,, end_log_pos  103016490,,   Could  not  execute  Write_rows  event 提醒table  * * * * * *,,   Multi-statement  transaction  required  more  than “max_binlog_cache_size”, bytes  of 存储,,   increase 却;能够mysqld  variable 以及try 再次,Error_code:, 1197,,   Writing  one  row 用,row-based  binary  log 失败了,,Error_code:,, 1534;   handler  error  HA_ERR_RBR_LOGGING_FAILED;,   从而事件's  master  log 首先,end_log_pos  103016490,, Error_code:, 1197

处理过程:

根据报错信息,知道是max_binlog_cache_size小了,

解决办法:临时增加该值后重启奴隶即可以继续复制线程。

stop 奴隶;   set  global  max_binlog_cache_size=, 201326592;   start 奴隶;

关于max_binlog_cache_size请看这里:

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

查看主库中日志的具体内容:

数据库日志格式为混合,文件中记录的是行格式,使用下面命令查看

/bin/mysqlbinlog ,, -vv ——base64-output=decode-rows  mysql.135371  |,更多的 精简后的内容:   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  10538, CRC32 , Write_rows: table  id  2776   #,at  10538,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  18175, CRC32 , Write_rows: table  id  2776   #,at  18175,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  25789, CRC32 , Write_rows: table  id  2776   #,at  25789,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  33424, CRC32 , Write_rows: table  id  2776   #,at  33424,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  40961, CRC32 , Write_rows: table  id  2776   #,at  40961,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  48553, CRC32 , Write_rows: table  id  2776   #,at  48553,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  56126, CRC32 , Write_rows: table  id  2776   #,at  56126,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,   #,,13:43:59  server  id  * * * * * * *,, end_log_pos  63671, CRC32 , Write_rows: table  id  2776   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

【MySQL故障处理】Seconds_Behind_Master=NULL Error_code: 1197