1. 程式人生 > >hive安裝報錯

hive安裝報錯

當我們輸入./schematool -initSchema -dbType mysql的時候,會出現以下錯誤

Metastore connection URL: jdbc:mysql://192.168.*./hive?createDatabaseIfNotExist=true
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: hiveuser
Starting metastore schema initialization to 2.1.0
Initialization script hive-schema-2.1.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 !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use –verbose for detailed stacktrace.
* schemaTool failed *

以上錯誤檢視mysql是否已經建立了hive這個表, 如果建立,你想從新安裝的話,把那個你建立的表刪了即可

 

 

啟動hive報警告: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

根據提示在hive配置檔案hive-site.xml中修改javax.jdo.option.ConnectionURL引數

修改前:

jdbc:mysql://10.10.110.110:3306/hive?characterEncoding=utf8&useSSL=false

修改後:

jdbc:mysql://10.10.110.110:3306/hive?characterEncoding=utf8&useSSL=false

啟動hive後報錯,出現The reference to entity "useSSL" must end with the ';' delimiter錯誤,查詢一番後發現原來在xml檔案中 &符號 需要轉義 這個根據 HTML 的轉義規則 更改就行
& ->&於是便解決了。

正確配置:

jdbc:mysql://10.10.110.110:3306/hive?characterEncoding=utf8&useSSL=false

 

完整配置如下:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.122.15:3306/hive?createDatabaseIfNotExsit=true;characterEncoding=UTF-8&amp;useSSL=false</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hivee</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>

<property>
<name>datanucleus.readOnlyDatastore</name>
<value>false</value>
</property>
<property>
<name>datanucleus.fixedDatastore</name>
<value>false</value>
</property>

<property>
<name>datanucleus.autoCreateSchema</name>
<value>true</value>
</property>

<property>
<name>datanucleus.autoCreateTables</name>
<value>true</value>
</property>