Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000: Invalid status 16 (state=08S01,code=0)

使用beeline 连接 hive 报标题所示错误。

连接语句:

!connect jdbc:hive2://localhost:10000/default

在输入用户名和密码后,出现错误:

20/10/24 20:28:38 [main]: WARN jdbc.HiveConnection: Failed to connect to localhost:10000
Unknown HS2 problem when communicating with Thrift server.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000: Invalid status 16 (state=08S01,code=0)
Beeline version 3.1.2 by Apache Hive

但神奇的是,如果不写上主机信息是可以的

[20:28 hadoop@Cavin-Y7000 hive]$ beeline -u jdbc:hive2://
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/hdfs/lib/log4j-slf4j-impl-2.10.0.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]
Connecting to jdbc:hive2://
20/10/24 20:30:27 [main]: WARN conf.HiveConf: HiveConf of name hive.server2.connection.host does not exist
Hive Session ID = 4977083b-4d07-4ff0-930f-7afb9e214933
20/10/24 20:30:28 [main]: WARN session.SessionState: METASTORE_FILTER_HOOK will be ignored, since hive.security.authorization.manager is set to instance of HiveAuthorizerFactory.
20/10/24 20:30:29 [main]: WARN metastore.ObjectStore: datanucleus.autoStartMechanismMode is set to unsupported value null . Setting it to value: ignored
20/10/24 20:30:30 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:30 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:30 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:30 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:30 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:30 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:31 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:31 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:31 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:31 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:31 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
20/10/24 20:30:31 [main]: WARN DataNucleus.MetaData: Metadata has jdbc-type of null yet this is not valid. Ignored
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.2 by Apache Hive
0: jdbc:hive2://>

真是百思不得骑姐。网上各种找都没有任何一个人遇到这样的问题,虽然也有Could not open client transport with JDBC Uri,但他们的报错后面都会跟着Connection refuse,那个是权限问题,而我的这个问题什么具体的报错都没给。

后来想起在 /etc/hosts 中有一条 127.0.1.1 的记录是指向本机的(我的hadoop采用伪分布式安装)。具体如下:

127.0.1.1       Cavin-Y7000.localdomain Cavin-Y7000

然后尝试着在beeline连这个IP,居然通了!

./bin/beeline -u jdbc:hive2://127.0.1.1:10000/default
posted @ 2020-10-24 22:06  东围居士  阅读(3588)  评论(0编辑  收藏  举报