MySQL网络原因导致的连接失败

2021-12-22  本文已影响0人  只是甲

一. 问题描述

今天朋友的数据库出现了一些连接失败,如下图:


image.png

查看MySQL的错误日志,发现有如下报错:

2021-12-13T22:31:33.921945Z 163060 [Warning] IP address '*.*.*.*' could not be resolved: Name or service not known

2021-12-14T01:22:46.151797Z 163180 [Warning] IP address '*.*.*.*' has been resolved to the host name '*.*.*.*.bc.googleusercontent.com', which resembles IPv4-address itself.
2021-12-14T01:22:46.258768Z 163180 [Note] Got an error reading communication packets

二. 解决方案

初步判断有三种可能性:

  1. 网络丢包
  2. MySQL反向解析
  3. 连接超时

考虑网络丢包可能是应用层服务器到数据库服务器之间的问题,而且存在多个应用服务器连接数据库,优先解决2和3两个问题

修改mysql配置文件,添加如下:

connect_timeout = 180
skip-name-resolve

然后重启MySQL,持续观察问题是否解决,待更新。

上一篇 下一篇

猜你喜欢

热点阅读