0

这个问题在这里很常见,有几种口味。在这种情况下,我设置了一个没有身份验证 ( NOSASL ) 的 HiveServer2,它在 Python 中工作,我使用 Impyla 库进行连接。当我使用直线连接时,无法获得有效的连接。

直线结束于:

 beeline> !connect jdbc:hive2://127.0.0.1:10000/default/hive
 Error: Could not open client transport with JDBC Uri: jdbc:hive2://127.0.0.1:10000/default/hive: null (state=08S01,code=0)

在 HiveServer2 日志中,我有:

17/11/16 20:59:35 [HiveServer2-Handler-Pool: Thread-34]: ERROR server.TThreadPoolServer: Thrift error occurred during processing of message.
org.apache.thrift.protocol.TProtocolException: Missing version in readMessageBegin, old client?
    at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:228)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:27)
    at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
    at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

有任何想法吗?

4

1 回答 1

4

最后,我找到了解决方案。

!connect jdbc:hive2://127.0.0.1:10000/default/;auth=noSasl

使用它我可以连接到 HiveServer2。另外,我正在使用 HiveServer2 进行开发,所以我在 root 下启动了进程,并且所有文件系统树都属于 root。由于这个选项,我需要在使用 beeline 登录 HiveServer2 时使用 root 用户:

Connecting to jdbc:hive2://127.0.0.1:10000/default/;auth=noSasl
Enter username for jdbc:hive2://127.0.0.1:10000/default/;auth=noSasl: root
Enter password for jdbc:hive2://127.0.0.1:10000/default/;auth=noSasl: 
Connected to: Apache Hive (version 1.2.2)

我不需要提供密码,因为根本没有身份验证。现在我可以创建数据库和表了。

这个“ ​Comparing Beeline to the Hive CLI ”是解决这个问题的有效参考。

于 2017-11-17T08:55:27.047 回答