当前位置:网站首页>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.
边栏推荐
- The virtual machine Ping is connected to the host, and the host Ping is not connected to the virtual machine
- Windows下安装MongDB教程、Redis教程
- Why can't I use the @test annotation after introducing JUnit
- [recommended by bloggers] C WinForm regularly sends email (with source code)
- Some notes of MySQL
- Codeforces Round #771 (Div. 2)
- Principes JDBC
- 【博主推荐】C#MVC列表实现增删改查导入导出曲线功能(附源码)
- Learn winpwn (3) -- sEH from scratch
- FRP intranet penetration
猜你喜欢
[recommended by bloggers] C WinForm regularly sends email (with source code)
Did you forget to register or load this tag 报错解决方法
[Thesis Writing] how to write function description of jsp online examination system
[recommended by bloggers] C # generate a good-looking QR code (with source code)
Django running error: error loading mysqldb module solution
Knowledge Q & A based on Apache Jena
机器学习--人口普查数据分析
Machine learning notes week02 convolutional neural network
[number theory] divisor
QT creator support platform
随机推荐
Base de données Advanced Learning Notes - - SQL statements
数数字游戏
Install mysql5.5 and mysql8.0 under windows at the same time
LeetCode #461 汉明距离
Unable to call numpy in pycharm, with an error modulenotfounderror: no module named 'numpy‘
软件测试与质量学习笔记3--白盒测试
Django运行报错:Error loading MySQLdb module解决方法
Are you monitored by the company for sending resumes and logging in to job search websites? Deeply convinced that the product of "behavior awareness system ba" has not been retrieved on the official w
Solution: log4j:warn please initialize the log4j system properly
Learn winpwn (2) -- GS protection from scratch
QT creator runs the Valgrind tool on external applications
L2-006 树的遍历 (25 分)
Ansible practical Series II_ Getting started with Playbook
02-项目实战之后台员工信息管理
Data dictionary in C #
JDBC原理
When you open the browser, you will also open mango TV, Tiktok and other websites outside the home page
QT creator specifies dependencies
@Controller, @service, @repository, @component differences
[recommended by bloggers] background management system of SSM framework (with source code)