Hive启动常见报错及解决办法:[Exception in thread “main” java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate
报错内容:
[Exception in thread “main” java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
Caused by: java.lang.reflect.InvocationTargetException
Caused by: MetaException(message:Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: java.net.ConnectException: 拒绝连接 (Connection refused)
Caused by: java.net.ConnectException: 拒绝连接 (Connection refused)]
原因1:未启动metastore服务:
解决办法:
cd %HIVE_HOME%\bin
并输入:
hive --service metastore &
bin/hive
原因2:未初始化数据库:
解决办法:
cd %HIVE_HOME%\bin
并输入:
schematool -dbType mysql -initSchema
如果初始化失败,输出mysql -uroot -p123456进入mysql操作界面,删除hive数据库,再次尝试.
原因3:未正确配置%HIVE_HOME%\conf\hive-site.xml
具体看注释:
<configuration>
<!-- 存储元数据mysql相关配置,其中地址要填写你本地ip,端口号默认为3306 -->
<property>
<name><