Hive CLI启动报错Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

Hive CLI启动报错Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

  • Background
  • Solution

Background

在Hadoop集群上启动Hive 客户端,报了如下错误:

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

一般这种情况是由于 metastore 服务未开启所致。

Solution

  1. 前置:HIVE_HOME 已经被添加为系统环境变量
  2. 输入命令
    hive --service metastore &
➜  ext source ~/.zshrc                                                                                                
➜  ext hive --service metastore &
[1] 39705
➜  ext 2023-05-28 23:00:55: Starting Hive Metastore Server
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/onetwothree/BIGDATA_DEV/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/homebrew/Cellar/hadoop/3.3.1/libexec/share/hadoop/common/lib/slf4j-log4j12-1.7.30.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]
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
  1. 再次输入命令 Hive,进入Hive交互式命令行界面:
➜  lib hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/onetwothree/BIGDATA_DEV/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/homebrew/Cellar/hadoop/3.3.1/libexec/share/hadoop/common/lib/slf4j-log4j12-1.7.30.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]
Hive Session ID = 52d1397e-df67-40b5-b47f-a1b4d4adfd04

Logging initialized using configuration in jar:file:/Users/onetwothree/BIGDATA_DEV/hive-3.1.2/lib/hive-common-3.1.2.jar!/hive-log4j2.properties Async: true
Hive Session ID = bc2fd479-9774-4da3-b395-48b91f93a3a8
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive> show databases;
OK
default
Time taken: 0.391 seconds, Fetched: 1 row(s)
hive>

你可能感兴趣的:(hadoop,hive,apache)