boredbird 2020-04-08
WARN: Establishing SSL connection without server‘s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn‘t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false‘. You need either to explicitly disable SSL by setting useSSL=false,or set useSSL=true and provide truststore for server certificate verification.
今天玩kafka监控的时候,以前的项目突然跑不起来了,折腾了几个小时排查清楚。
原因是mysql的SSL默认开启的,而且mysql8.0.12版本的驱动也和mysql5.2.23左右版本(我以前用的版本)的不一样。画
我的排查步骤基本如下:
1.检查项目引用的mysql版本及本地maven库相同版本是否存在;
2.检查数据库驱动,我现在8.0.12本版本
com.mysql.cj.jdbc.Driver kafka.eagle.driver=com.mysql.cj.jdbc.Driver
3.查询SSL的状态
have_openssl=YES,即SSL是开启的,有需要的同学可以搜一下如何通过mysql配置文件关闭SSL(因为我没有关闭成功,所以在这里不展示具体步骤)。
mysql> SHOW VARIABLES LIKE ‘%ssl%‘; +---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | have_openssl | YES | | have_ssl | YES | | ssl_ca | ca.pem | | ssl_capath | | | ssl_cert | server-cert.pem | | ssl_cipher | | | ssl_crl | | | ssl_crlpath | | | ssl_key | server-key.pem | +---------------+-----------------+
4.关闭SSL,在数据库连接url中要添加关闭SSL的参数userSSL=true
kafka.eagle.url = jdbc:mysql://localhost/ke?userSSL=true&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT
参考文章来源:
1. MySQL5.5.45+ 5.6.26+ 5.7.6+关闭SSL验证:https://blog.csdn.net/boonya/article/details/102565062?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-10&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-10
2.mysql 8.0.18 调用出错解决办法:https://blog.csdn.net/qq_40604437/article/details/103715864?depth_1-utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-3&utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-3