hive运行报错

执行hive时报错,即使最简单的show databases也报错:

hive> show databases;
FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

查了各种各样的原因都没解决,后来想重新初始化一下,发现了还有这样的命令schematool -dbType mysql -info可以直接查看hive的情况,所以就执行了一下该命令,结果报错了:

org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: java.sql.SQLException : The server time zone value 'EDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
SQL Error code: 0
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

这个问题在我初始化的时候也遇到过,是时间差的问题,照如下步骤进行操作:

  1. 在终端执行date命令,查看时间
  2. mysql -uroot -ppassword启动mysql
  3. 在mysql中执行show variables like '%time_zone%';
  4. 输入select nows();
  5. 发现终端时间和mysql的时间不一致(也有可能时间看着差不多,其实有时间差),这就是问题的原因了。
  6. 然后在mysql中执行set time_zone=SYSTEM;
  7. mysql中继续执行set global time_zone='+8:00';
  8. 执行flush privileges;进行刷新。

按步骤执行完毕后,退出mysql,再次执行schematool -dbType mysql -info,发现显示:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/apps/apache-hive-2.3.3-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/apps/hadoop-2.7.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL:        jdbc:mysql://192.168.186.101:3306/hive?useSSL=false
Metastore Connection Driver :    com.mysql.cj.jdbc.Driver
Metastore connection User:       root
Hive distribution version:       2.3.0
Metastore schema version:        2.3.0
schemaTool completed

成功了,然后再次运行hive,就能正确执行任务。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值