org.springframework.dao.RecoverableDataAccessException: StatementCallback; SQL [DELETE FROM config_info WHERE data_id=‘com.alibaba.nacos.testMasterDB’]; Communications link failure
The last packet successfully received from the server was 3,658 milliseconds ago. The last packet sent successfully to the server was 4,862 milliseconds ago.; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet successfully received from the server was 3,658 milliseconds ago. The last packet sent successfully to the server was 4,862 milliseconds ago.
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:100)
首先贴上错误信息,总之是和超时有关。
方法一:按照网上的说法重新配置了mysql,具体命令为:
set global wait_timeout=31536000;
set global interactive_timeout=31536000;
查看结果
结果不起作用。
方法二:
nacos.conf中有关配置:
仔细研读了nacos.conf发现其使用的是hikari CP连接池,而该连接池的官网FAQ:https://github.com/brettwooldridge/HikariCP/wiki/FAQ#q2有如下解答:官网FAQ
并未真正尝试该方法,只能说可能可以解决,只是提供一个思路。
方法三:
最后真正解决问题的是下面的方法:将db.url的127.0.0.1改成localhost
参考博客:https://blog.csdn.net/qq_27471405/article/details/80921846
该博客中还有多种解决方法,值得参考。
这个bug卡了我至少十多个小时,写篇博客记录一下TAT.