WARN: Establishing SSL connection without server’s identity verification is not recommended

一、問題
Hive能正常執行任務,但出現“WARN: Establishing SSL connection without server’s identity verification is not recommended.”告警,翻譯過來就是“不建議不使用服務器身份驗證建立SSL連接。”

Thu Jun 15 12:56:05 CST 2017 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.

而且不處理的話,會一直產生警告



產生的原因是使用JDBC連接MySQL服務器時爲設置useSSL參數

二、解決方法
根據告警提示有兩種解決方法:

1.設置useSSL=false
這裏有個坑就是hive的配置文件是.XML格式,而在xml文件中&才表示&,所以正確的做法是在Hive的配置文件中,如hive-site.xml進行如下設置

  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>
    <description>JDBC connect string for a JDBC metastore</description>
  </property>


2.設置useSSL = true併爲服務器證書驗證提供信任庫。

<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=true</value>
    <description>JDBC connect string for a JDBC metastore</description>
  </property>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章