当前位置:网站首页>Aborted connection 1055898 to db:
Aborted connection 1055898 to db:
2022-07-06 11:22:00 【wx5caecf2ed0645】
mysql In the error log , Find a lot of similar information below :(mysql 5.7.18)
[Note] Aborted connection 1055898 to db: 'xxx' user: 'yyy' host: 'xxx.xxx.xxx.xxx' (Got timeout reading communication packets)
- 1.
such Aborted connection Under the circumstances ,mysql Will increase aborted_clients The value of the status counter . This also means the following questions :
(1) The client is connected normally , But it ended abnormally ( It may be that the program does not close the connection normally )
(2) client sleep More than wait_timeout、 or interactive_timeout Value ( This will cause the connection to be mysql closed )
(3) Client exception terminal , Or the query exceeds max_allowed_packet Value
- 1.
-
mysql> show variables like '%max_allowed_packet%';
-
+--------------------------+------------+
-
| Variable_name | Value |
-
+--------------------------+------------+
-
| max_allowed_packet | 16777216 |
-
| slave_max_allowed_packet | 1073741824 |
-
+--------------------------+------------+
Of course , It may also be caused by other reasons . To be honest , Abnormal terminals are difficult to diagnose , It may also be with the network 、 Firewall related . Consider the following aspects :
1. If there are a large number of connection processes in sleep State time is long , That means the application is not correct 、 Close the database connection in time . It is strongly recommended to properly close the database connection in the application , Otherwise, we need to rely on mysql Of wait_timeout To close the connection .
2. It is recommended to check max_allowed_packet Value , Ensure that the value is set reasonably , In this way, the client will not receive "packet too large" Message tip . If the setting is unreasonable , The connection will be abnormally disconnected .
3. It is suggested to pay attention to the process time_wait Number . If netstat Found a large number of connections in time_wait state , It indicates that the connection closing problem of the proposed application end adjustment .
- 1.
-
# netstat -ano|grep TIME_WAIT
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:55586 TIME_WAIT timewait (32.97/0/0)
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:55367 TIME_WAIT timewait (27.82/0/0)
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:55776 TIME_WAIT timewait (37.09/0/0)
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:56505 TIME_WAIT timewait (54.61/0/0)
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:55553 TIME_WAIT timewait (31.94/0/0)
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:56643 TIME_WAIT timewait (57.73/0/0)
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:55221 TIME_WAIT timewait (23.70/0/0)
-
tcp 0 0 xxx.xxx.xxx.xxx:10054 xxx.xxx.xxx.xxx:55920 TIME_WAIT timewait (41.18/0/0)
4. Make sure the transaction is correct 、 Submitted in time .
5. Ensure that there is no abnormal disconnection on the application side , such as php If set max_execution_time=5, Even if you increase connect_timeout The value of will not have an effect . Other programming languages have similar problems .
6. Check DNS Whether there is delay problem in the configuration . Check whether skip_name_resolve, And the use of IP Verify the host instead of using the host name . After setting this parameter , Use ip Verify the host , Instead of using host names . After using this parameter ,mysql In the authorization table host Column must be IP Address or localhost.
7. If it is percona, You can open the audit log .
8. increase net_read_timeout、net_write_timeout Value , And observe whether the error still occurs .net_read_timeout Rarely lead to errors , Unless the network environment is very poor .
The connection to the abnormal terminal is because the connection is not normal .server End will not cause connection abort, Unless the client / There is a network problem on the server . But this is also caused by the network , instead of server End of the problem . Network problems can be viewed with the help of tools , such as :tcpdump,netstat -s
Go back to the problem itself , Have a look first mysql Parameter Settings :
- 1.
-
mysql> show variables like '%timeout%';
-
+-----------------------------+----------+
-
| Variable_name | Value |
-
+-----------------------------+----------+
-
| connect_timeout | 10 |
-
| interactive_timeout | 1800 |
-
| lock_wait_timeout | 31536000 |
-
| net_read_timeout | 30 |
-
| net_write_timeout | 60 |
-
| wait_timeout | 1800 |
-
+-----------------------------+----------+
-
mysql> show global variables like '%log_warning%';
-
+---------------+-------+
-
| Variable_name | Value |
-
+---------------+-------+
-
| log_warnings | 2 |
-
+---------------+-------+
-
1 row in set (0.00 sec)
-
mysql>
If log_warnings The value is greater than 1,mysql Similar information will be written to the error log :
- 1.
-
[Warning] Aborted connection 305628 to db: 'db' user: 'dbuser' host: 'hostname' (Got an error reading communication packets)
-
[Warning] Aborted connection 305627 to db: 'db' user: 'dbuser' host: 'hostname' (Got an error reading communication packets)
If you don't want to record this information in the log , It can be modified log_waring Value :
mysql>set global log_warnings=1;
- 1.
边栏推荐
- L2-006 树的遍历 (25 分)
- Use dapr to shorten software development cycle and improve production efficiency
- Software testing and quality learning notes 3 -- white box testing
- Error connecting to MySQL database: 2059 - authentication plugin 'caching_ sha2_ The solution of 'password'
- Deoldify项目问题——OMP:Error#15:Initializing libiomp5md.dll,but found libiomp5md.dll already initialized.
- QT creator specify editor settings
- The virtual machine Ping is connected to the host, and the host Ping is not connected to the virtual machine
- 安装numpy问题总结
- How to set up voice recognition on the computer with shortcut keys
- SSM integrated notes easy to understand version
猜你喜欢
Leetcode 461 Hamming distance
MySQL主从复制、读写分离
[ahoi2009]chess Chinese chess - combination number optimization shape pressure DP
Neo4j installation tutorial
Introduction and use of automatic machine learning framework (flaml, H2O)
02 staff information management after the actual project
Basic use of redis
【博主推荐】asp.net WebService 后台数据API JSON(附源码)
引入了junit为什么还是用不了@Test注解
MySQL master-slave replication, read-write separation
随机推荐
Basic use of redis
Leetcode 461 Hamming distance
QT creator shape
ImportError: libmysqlclient. so. 20: Cannot open shared object file: no such file or directory solution
Data dictionary in C #
AI benchmark V5 ranking
Kept VRRP script, preemptive delay, VIP unicast details
引入了junit为什么还是用不了@Test注解
QT creator runs the Valgrind tool on external applications
AcWing 1294. Cherry Blossom explanation
QT creator create button
Julia 1.6 1.7 common problem solving
[recommended by bloggers] C MVC list realizes the function of adding, deleting, modifying, checking, importing and exporting curves (with source code)
Knowledge Q & A based on Apache Jena
L2-006 树的遍历 (25 分)
[蓝桥杯2017初赛]包子凑数
數據庫高級學習筆記--SQL語句
Introduction and use of automatic machine learning framework (flaml, H2O)
Classes in C #
L2-007 家庭房产 (25 分)