赞
踩
执行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 ***
这个问题在我初始化的时候也遇到过,是时间差的问题,照如下步骤进行操作:
date
命令,查看时间mysql -uroot -ppassword
启动mysqlshow variables like '%time_zone%';
select nows();
set time_zone=SYSTEM;
set global time_zone='+8:00';
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,就能正确执行任务。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。