【问题标题】:beeline can connect to jdbc:hive2:// but cannot connect to jdbc:hive2://localhost:10000直线可以连接到 jdbc:hive2:// 但不能连接到 jdbc:hive2://localhost:10000
【发布时间】:2021-08-30 18:36:12
【问题描述】:

我正在努力与 Hive 服务器的直线连接。在我的服务器上(名字叫Sun,在这台服务器上的所有操作),在hive文件夹中,我可以以./bin/beeline开始直线,然后连接到hive:!connect jdbc:hive2://,然后我成功连接到我的hive,我可以运行 hive-sql 语句。

但是,当我尝试./bin/beeline -u jdbc:hive2://localhost:10000 -n hive -p mypassword 时,我无法直接连接到 hive,并显示错误消息“错误:无法使用 JDBC Uri 打开客户端传输:jdbc:hive2://localhost:10000”

我尝试关注很多帖子(例如beeline cannot connect to hive2serverConnecting to Hive using BeelineCannot connect to beeline hive2),但我仍然找不到解决方案。为什么我无法连接到 localhost:10000(或者它的这台 Sun 机器的 IP)?

有谁知道我为什么会出现这样的错误以及如何解决它?

hadoop@Sun:/opt/apache-hive-3.1.2-bin$ ./bin/beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl- 
2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/lib/hadoop-3.2.2/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]
Beeline version 3.1.2 by Apache Hive
beeline> !connect jdbc:hive2://
Connecting to jdbc:hive2://
Enter username for jdbc:hive2://: hive
Enter password for jdbc:hive2://: ****
21/06/14 23:02:10 [main]: WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Hive Session ID = ae2fb753-de6d-4522-b128-770b1c358c8b
21/06/14 23:02:11 [main]: WARN session.SessionState: METASTORE_FILTER_HOOK will be ignored, since hive.security.authorization.manager is set to instance of HiveAuthorizerFactory.
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://> show databases;
OK
+----------------+
| database_name  |
+----------------+
| default        |
| testwimp       |
| wimp           |
+----------------+
3 rows selected (1.978 seconds)
0: jdbc:hive2://> !connect jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: hive
Enter password for jdbc:hive2://localhost:10000: ****
21/06/14 23:02:57 [main]: WARN jdbc.HiveConnection: Failed to connect to localhost:10000
Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000: java.net.ConnectException: Connection refused (Connection refused) (state=08S01,code=0)
0: jdbc:hive2://>

【问题讨论】:

  • @linusRian,我看到了这个帖子,但是看不懂,把端口号从10000改成100001?
  • 看来这个问题是一个未完全解决的open bug:issues.apache.org/jira/browse/HIVE-14410
  • 不只是端口号,还有添加了transportMode和httpPath的url,在上面的链接中提到了。 jdbc:hive2://:/;transportMode=http;httpPath=
  • @linusRian,我认为这不是我正在寻找的答案。 1st,httpPath/http_endpoint 不是 hive-site.xml 文件中的属性。第二,即使我尝试了这样的附加信息,它仍然有相同的错误信息。 3、直接通过“jdbc:hive2://localhost:10000”连接适用于很多其他人,无需指定http模式。 (我确信在我的 Linux 服务器上,我使用的是 ssl 而不是 http 模式)。

标签: hadoop jdbc hive localhost beeline


【解决方案1】:

这里有详细解答:

https://www.programmersought.com/article/93495333620/

综上,检查 hiverserver2 是否启动,10000 端口是否打开。

【讨论】:

    猜你喜欢
    • 2021-11-27
    • 2016-08-25
    • 2021-05-19
    • 2018-04-24
    • 2012-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-16
    相关资源
    最近更新 更多