启动hive之后执行语句报错如下:
FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
查询后得知是hive的数据库MySQL在安装的时候没有初始化
解决办法:初始化数据库
schematool -dbType mysql -initSchema
然后出现错误:
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
下面的解释应该是mysql时区的问题
个人解决方法是:
打开/usr/local/hive/conf/hive-site.xml
hive配置文件hive-site.xml中ConnectionURL中加上serverTimezone=GMT就可以了。
然后重新运行 :
schematool -dbType mysql -initSchema
之后进入hive执行指令无报错。