MySQL--半同步复制与参数slave_compressed_protocol

问题场景

MySQL版本:5.7.26-29-log Percona Server (GPL)

操作系统版本:CentOS Linux release 7.6.1810 (Core)

BINLOG产生速度:

问题描述

配置半同步的集群频繁报警,提示集群主节点状态rpl_semi_sync_master_clients=0,即从半同步状态退化为异步状态。

查看主从复制正常,但从库错误日志中有:

2023-02-13T09:44:00.700625+08:00 160 [ERROR] Error reading packet from server for channel '': Lost connection to MySQL server during query (server_errno=2013)
2023-02-13T09:44:00.700652+08:00 160 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
2023-02-13T09:44:02.177640+08:00 160 [ERROR] Error reading packet from server for channel '': Lost connection to MySQL server during query (server_errno=2013)
2023-02-13T09:44:02.177670+08:00 160 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
2023-02-13T09:44:05.965457+08:00 160 [ERROR] Error reading packet from server for channel '': Lost connection to MySQL server during query (server_errno=2013)
2023-02-13T09:44:05.965486+08:00 160 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.

主库错误日志中有:

--
2023-02-13T09:44:00.700648+08:00 0 [ERROR] /home/q/mysql/multi/3309/private/bin/mysqld: Got an error reading communication packets
2023-02-13T09:44:00.702066+08:00 232112955 [Note] While initializing dump thread for slave with UUID <9b1ee63e-ebba-11ec-83a2-84656961b909>, found a zombie dump thread with the same UUID. Master is killing the zombie dump thread(232112906).
2023-02-13T09:44:00.702106+08:00 232112906 [Note] Stop semi-sync binlog_dump to slave (server_id: 30165)
2023-02-13T09:44:00.702115+08:00 232112906 [Note] Semi-sync replication switched OFF.
2023-02-13T09:44:00.702160+08:00 232112955 [Note] Start binlog_dump to master_thread_id(232112955) slave_server(30165), pos(, 4)
--
2023-02-13T09:44:02.177660+08:00 0 [ERROR] /home/q/mysql/multi/3309/private/bin/mysqld: Got an error reading communication packets
2023-02-13T09:44:02.179184+08:00 232112972 [Note] While initializing dump thread for slave with UUID <9b1ee63e-ebba-11ec-83a2-84656961b909>, found a zombie dump thread with the same UUID. Master is killing the zombie dump thread(232112955).
2023-02-13T09:44:02.179226+08:00 232112955 [Note] Stop semi-sync binlog_dump to slave (server_id: 30165)
2023-02-13T09:44:02.179238+08:00 232112955 [Note] Semi-sync replication switched OFF.
2023-02-13T09:44:02.179281+08:00 232112972 [Note] Start binlog_dump to master_thread_id(232112972) slave_server(30165), pos(, 4)
--
2023-02-13T09:44:05.965481+08:00 0 [ERROR] /home/q/mysql/multi/3309/private/bin/mysqld: Got an error reading communication packets
2023-02-13T09:44:05.966863+08:00 232113022 [Note] While initializing dump thread for slave with UUID <9b1ee63e-ebba-11ec-83a2-84656961b909>, found a zombie dump thread with the same UUID. Master is killing the zombie dump thread(232112972).
2023-02-13T09:44:05.966897+08:00 232112972 [Note] Stop semi-sync binlog_dump to slave (server_id: 30165)
2023-02-13T09:44:05.966916+08:00 232112972 [Note] Semi-sync replication switched OFF.
2023-02-13T09:44:05.966948+08:00 232113022 [Note] Start binlog_dump to master_thread_id(232113022) slave_server(30165), pos(, 4)

PS: MySQL参数log_warnings用于控制错误日志的输出详细情况。

主节点产生BINLOG速度较慢,约10天才产生300MB的BINLOG日志。

解决办法

经排查发现,该问题主要由MySQL参数slave_compressed_protocol再半同步场景下引发的BUG,在主从节点上关闭该参数并重启复制即可解决。

相关连接

posted @ 2023-02-13 10:59  TeyGao  阅读(124)  评论(0编辑  收藏  举报