初始化hive的元数据到mysql的中报错org.apache.hadoop.hive.metastore.HiveMetaException

这个问题真的坑!!!

虚拟机配置完hive,当进行初始化元数据到mysql中的时候报错org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version

[root@centos01 bin]# ./schematool -initSchema -dbType mysql
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hive/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:/usr/hadoop/hadoop-2.7.3/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://localhost:3306/hive?useSSL=true
Metastore Connection Driver :	 com.mysql.jdbc.Driver
Metastore connection User:	 root
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException : Communications link failure

The last packet successfully received from the server was 1,206 milliseconds ago.  The last packet sent successfully to the server was 1,200 milliseconds ago.
SQL Error code: 0
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

当检查完配置文件都没出错的时候,看看mysql的版本号,我的mysql的版本号为5.7.25,换过的几个版本的驱动jar包,当把hive/lib的mysql驱动jar包换成5.1.24。再此初始化就没有问题了。具体原因也不清楚,可能是版本不兼容。

 

jar包:https://download.csdn.net/download/qq_42454244/10967268

也可以通过maven自行下载。

你可能感兴趣的:(Hadoop)