hive3.1.2整体解压替换之前hive
FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.me错误
如果你整体解压替换后,你的hive的配置文件依旧是原来的,看起来好像没有问题,毕竟只是配置hive的mysql元数据之类的信息,但是报错
FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.me
这时候基本的解决就是 schematool -dbType mysql -initSchema
这个意义是初始化hive ,简单理解就是初始化mysql 中你的hive对应的库,创建时候没有初始化,但是这时候却出现了下面这个错误Error: Table ‘CTLGS’ already exists (state=42S01,code=1050)
[root@hadoop01 hive]# schematool -dbType mysql -initSchema
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop313/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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://hadoop01:3306/metastore?useSSL=false
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: root
Starting metastore schema initialization to 3.1.0
Initialization script hive-schema-3.1.0.mysql.sql
Error: Table 'CTLGS' already exists (state=42S01,code=1050)
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 ***
这个问题就有点像Java程序中 A你初始化对象成a,然后有个B,他和A一摸一样,那么你new 后难道说a和B初始化的对象一样,这就不行,你只能从新分配内存,所以你的hive-site.xml配置的mysql需要重新设定数据库。
这时候在执行就成功了,然后你再去查询之前的配置hive元数据库,就会发现里面的表就都是不存在的了。