ngx_healthcheck_module icon indicating copy to clipboard operation
ngx_healthcheck_module copied to clipboard

TCP 检查mysql的时候会导致错误日志一直报Got an error reading communication packets

Open xiaoluoji opened this issue 4 years ago • 2 comments

希望大佬能写一个专门除了http、tcp检查之外,额外增加一个mysql的检车,否则主动监控检查mysql的时候mysql错误日志里会一直出现报错 Got an error reading communication packets,并且如果mysql配置文件里不设置 host_cache_size = 0, 当error次数达到max_connect_errors值得时候,nginx的IP地址就会被mysql禁止连接,导致应用程序报错 image-20200710143918519

xiaoluoji avatar Jul 10 '20 07:07 xiaoluoji

这个是因为只对后端做了tcp连接性检查,没有和后端进行mysql协议交互造成的。

关于你提到的配置项,我通过这篇文章学习了一下:https://www.cnblogs.com/kerrycode/p/8405862.html

理论上增加mysql协议类型解析,去模拟mysql登录过程来进行健康检查是行的通的, 但是肯定需要在nginx.conf中增加mysql的认证信息配置。这样是否会涉及安全问题?

所以暂时通过设置host_cache_size = 0 是不是可以解决问题?

zhouchangxun avatar Jul 11 '20 06:07 zhouchangxun

是的,现在就是通过设置host_cache_size = 0

acheng-floyd avatar Apr 02 '21 10:04 acheng-floyd