hive执行sql报错
FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
![](https://img-blog.csdnimg.cn/f52547148fdd40ef926df0789217d611.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBASHlkcmEu,size_20,color_FFFFFF,t_70,g_se,x_16)
解决办法:1、初始化mysql数据库
2、注释配置文件$HIVE_HOME/conf/hive-site.xml
<!--
<property>
<name>hive.metastore.uris</name>
<value>thrift://master:9083</value>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
-->
初始化数据库
./schematool -dbType mysql -initSchema
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库,重新执行,问题解决。