Hive遇到的問題(詳細總結)

問題1:

hive配置完成以後執行:schematool --dbType mysql --initSchema
出現:

[hadoop@mini0 bin]$ ./schematool --dbType mysql --initSchema
Metastore connection URL:        jdbc:mysql://mini1:3306/metastore?createDatabaseIfNotExist=true
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:       hive
Thu Jul 12 21:46:27 CST 2018 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.
Starting metastore schema initialization to 1.2.0
Initialization script hive-schema-1.2.0.mysql.sql
Error: Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore 
state would be inconsistent !!
*** schemaTool failed ***

原因(調試時最好同時操作以下兩種可能):
一、當我看到上面的建議時:
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore
for server certificate verification.

於是我修改了hive-site.xml文件,加上了;useSSL=false,如下

<value>jdbc:mysql://mini1:3306/metastore?createDatabaseIfNotExist=true;useSSL=false</value>

這種結果是,繼續
*** schemaTool failed ***,於是我便把添加的;useSSL=false去掉了
二、繼續分析
鏈接數據庫:[hadoop@mini1 lib]$ mysql -u root -p
鏈接上數據庫之後,把配置時創建的metastore數據庫刪除,重新創建

drop database metastore; 
CREATE DATABASE metastore;
USE metastore;
SOURCE /home/hadoop/apps/hive/scripts/metastore/upgrade/mysql/hive-schema-0.9.0.mysql.sql;

然後執行,成功了;

[hadoop@mini0 bin]$ ./schematool --dbType mysql --initSchema
[hadoop@mini0 bin]$ ./schematool --dbType mysql --initSchema
Metastore connection URL:        jdbc:mysql://mini1:3306/metastore?createDatabaseIfNotExist=true
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:       hive
Starting metastore schema initialization to 1.2.0
Initialization script hive-schema-1.2.0.mysql.sql
Thu Jul 12 21:47:19 CST 2018 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.
schemaTool completed

分析了下原因可能是執行./schematool --dbType mysql --initSchema失敗後,有些表需要清理,不清理影響再次初始化,索性直接刪除數據庫,重新創建

詳細配置請轉到:https://blog.csdn.net/IbeleveIcan/article/details/81022475

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