通过案例分析通过案例分析MySQL中令人头疼的中令人头疼的Aborted告警告警
本文主要给大家介绍的是关于MySQL中Aborted告警的相关内容,分享出来供大家参考学习,下面来一起看看详细的介绍:
实战实战
Part1:写在最前写在最前
在MySQL的error log中,我们会经常性看到一些各类的Aborted connection错误,本文中会针对这类错误进行一个初步分析,
并了解一个问题产生后的基本排查思路和方法。掌握这种方法是至关重要的,而不是出现问题了,去猜,去试。数据库出现问
题的时候需要DBA在短时间内快速解决问题,因此一个好与坏的DBA,区别也在于此。
Part2:种类种类
[Warning] Aborted connection 305628 to db: 'db' user: 'dbuser' host: 'hostname' (Got an error reading communication packets)
[Warning] Aborted connection 81 to db:'unconnected' user: 'root' host: '127.0.0.1' (Got timeout reading communication
packets)
[Warning] Aborted connection 109 to db:'helei1' user: 'sys_admin' host: '192.168.1.1' (Got an error writing communication packets)
[Warning] Access denied for user 'root'@'127.0.0.1' (using password: YES)
[Warning] Got an error writing communication packets
Part3:重点参数分析重点参数分析
wait_timeout
Command-Line Format –wait-timeout=#
System Variable
Name wait_timeout
Variable Scope Global, Session
Dynamic Variable Yes
Permitted Values (Windows)
Type integer
Default 28800
Min Value 1
Max Value 2147483
Permitted Values (Other)
Type integer
Default 28800
Min Value 1
Max Value 31536000
这个参数指的是数据库系统在关闭它之前,服务器等待非交互式连接上的活动的秒数。
interactive_timeout
Command-Line Format –interactive-timeout=#
System Variable
Name interactive_timeout
Variable Scope Global, Session
Dynamic Variable Yes
Permitted Values
Type integer
Default 28800
Min Value 1
这个参数指的是在关闭交互式连接之前,服务器等待活动的秒数
Warning:警告警告这两个参数建议一起调节,能够避免一些坑。
本文的两个参数值采用的是默认值
mysql> show global variables like '%timeout%';
+----------------------------+----------+
| Variable_name | Value |
+----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
|interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |