问题描述
MySQL 5.7.19 开启半同步后, 主库,从库并无压力的情况下,复制异常慢. 连简单的create table 命令都要等上一会。但关闭半同步后,复制恢复正常。
Master日志中有如下错误:
2017-08-10T08:52:06.526471Z 0 [ERROR] Read semi-sync reply magic number error
2017-08-10T08:52:06.527582Z 0 [ERROR] /mysql/bin/mysqld: Got timeout reading communication packets
2017-08-10T08:52:11.519135Z 0 [ERROR] /mysql/bin/mysqld: Got an error reading communication packets
2017-08-10T08:52:11.522714Z 1437 [Note] While initializing dump thread for slave with UUID <4f5e10be-7d7e-11e7-b9de-fa1
63ee505c4>, found a zombie dump thread with the same UUID. Master is killing the zombie dump thread(796).
2017-08-10T08:52:11.522764Z 1437 [Note] Start binlog_dump to master_thread_id(1437) slave_server(2073316), pos(mysql-bi
n.000006, 1356)
2017-08-10T08:52:11.522796Z 796 [Note] Stop semi-sync binlog_dump to slave (server_id: 2073316)
2017-08-10T08:52:12.520237Z 1437 [Note] Start semi-sync binlog_dump to slave (server_id: 2073316), pos(mysql-bin.000006
, 1356)
2017-08-10T08:59:32.775318Z 0 [ERROR] /mysql/bin/mysqld: Got an error reading communication packets
2017-08-10T08:59:32.779383Z 1590 [Note] While initializing dump thread for slave with UUID <4f5e10be-7d7e-11e7-b9de-fa1
63ee505c4>, found a zombie dump thread with the same UUID. Master is killing the zombie dump thread(1437).
2017-08-10T08:59:32.779435Z 1590 [Note] Start binlog_dump to master_thread_id(1590) slave_server(2073316), pos(mysql-bi
n.000006, 1356)
经查与slave_compressed_protocol参数有关。
解决办法:
STOP SLAVE;SET GLOBAL slave_compressed_protocol=0; START SLAVE;