首页 > 代码库 > Got timeout reading communication packets解决方法

Got timeout reading communication packets解决方法

Got timeout reading communication packets解决方法

http://www.th7.cn/db/mysql/201702/225243.shtml

 

[Note] Aborted connection xxxx to db:

问题现象:在tail -f/data/logs/mysql/error.log日志中出现大量的如下信息(web用的是Zabbix,设置连接超时时间为100秒):


‘ host: ‘localhost‘ (Got timeout reading communication packets)
2017-02-05T15:30:19.272811+08:00 28546 [Note] Aborted connection 28546 to db: ‘zabbix‘ user: ‘zabbix‘ host: ‘localhost‘ (Got timeout reading communication packets)
2017-02-05T15:30:22.388624+08:00 28547 [Note] Aborted connection 28547 to db: ‘zabbix‘ user: ‘zabbix‘ host: ‘localhost‘ (Got timeout reading communication packets)
2017-02-05T15:30:27.119216+08:00 28554 [Note] Aborted connection 28554 to db: ‘zabbix‘ user: ‘zabbix‘ host: ‘localhost‘ (Got timeout reading communication packets)
解决办法:


修改[root@lovebuy114 ~]# grep timeout /etc/my.cnf


interactive_timeout = 120


wait_timeout = 120


log_warnings=1 //注意,我这里原来是2。修改成1后,问题现象果然但是已经不存在了。


在命令行中可以这样修改:


mysql>set global log_warning=1;


mysql>set global interactive_timeout = 120;


mysql>set global wait_timeout = 120;


参数简要说明:


1)interactive_timeout:


参数含义:服务器关闭交互式连接前等待活动的秒数。交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端。


参数默认值:28800秒(8小时)


解决无Notice的办法:


grep timeout /etc/my.cnf innodb_lock_wait_timeout = 60
interactive_timeout = 28800
wait_timeout = 22
grep log_warnings /etc/my.cnflog_warnings=2
From:http://blog.csdn.net/jamesyao008/article/details/45098073


修改后,无效,原因是现在是变成了Notice,不是警告:


tail -f/data/logs/mysql/error.log


2017-02-05T15:38:19.678134+08:00 128 [Note] Aborted connection 128 to db: ‘zabbix‘ user: ‘zabbix‘ host: ‘localhost‘ (Got timeout reading communication packets)


2017-02-05T15:38:22.452504+08:00 131 [Note] Aborted connection 131 to db: ‘zabbix‘ user: ‘zabbix‘ host: ‘localhost‘ (Got timeout reading communication packets)

Got timeout reading communication packets解决方法