在搭建测试环境的hive的时候,发现启动的时候,经常报以下警告信息
Thu May 14 09:52:26 CST 2020 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.
根据报错提示, MySQL 5.5.45+, 5.6.26+ and 5.7.6+默认采用SSL连接,如果需要取消这个警告,需要在url上加上添加useSSL=true,
jdbc:mysql://www.xxxx.com:3306/db?characterEncoding=utf8&useSSL=false
发现我用的mysql是5.7.23,符合上面描述,修改后,重启MetaStore,发现报了以下错误
Caused by: org.xml.sax.SAXParseException; systemId: file:/usr/apache-hive-1.2.1-bin/conf/hive-site.xml; lineNumber: 17; columnNumber: 88; The reference to entity "useSSL" must end with the ';' delimiter.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:150)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2432)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2420)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2488)
网上查了下,主要是hive-site.xml中url里参数分隔符&需要转义为 & 才行,修改如下解决。
jdbc:mysql://www.xxxx.com:3306/db?characterEncoding=utf8&useSSL=false