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>

原文地址:https://www.cnblogs.com/byfboke/p/9958868.html