当前位置:   article > 正文

The last packet successfully received from the server was 4 milliseconds ago.

the last packet successfully received from the server was 4 milliseconds ago

问题

The last packet successfully received from the server was 4 milliseconds ago. The last packet sent successfully to the server was 4 milliseconds ago.
在项目中使用xxl-job开发的任务处理器中,出现这个问题。查找日志前面出现Error updating database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure。
它表明 JDBC 客户端与 MySQL 数据库服务器之间的通信链接在某个点突然中断,但在错误消息给出的时间点,客户端和服务器之间仍然有数据包交换的记录。
在这里插入图片描述
报这个错误大多数是因为数据库连接的问题,有可能网络,有可能连接数。

排查:

1、mysql 查询 SHOW PROCESSLIST; (SHOW [FULL] PROCESSLIST 用于查看当前MySQL服务器上的所有运行中的进程列表信息。)
在这里插入图片描述 (Sleep:线程正在等待客户端发送新的语句给它。)

2、show variables like ‘max_connections’;(查看最大连接数)
在这里插入图片描述

最大连接数只有3000.

3、SELECT @@MAX_CONNECTIONS AS ‘Max Connections’;(查看当前连接数)

在这里插入图片描述

说明连接已经满了,3000满足不了需求。

排查:

1、在配置文件my.cnf中设置max_connections的值(重启后生效)
找到max_connections一行,修改为(如果没有,则自己添加)
max_connections = 16384
(最大连接数,这个参数实际起作用的最大值为16384)
###2、修改临时连接数(不需要重启mysql)
set GLOBAL max_connections=16384;

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/1014692
推荐阅读
相关标签
  

闽ICP备14008679号