python无法连接hiveserver2 [英] python cannot connect hiveserver2

查看:1940
本文介绍了python无法连接hiveserver2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试使用 https://cwiki.apache.org/confluence/上的示例display / Hive / Setting + Up + HiveServer2
但会出现以下错误:

  / usr / lib / python2.7 / dist-packages / pkg_resources.py:1031:UserWarning:/home/dsnadmin/.python-eggs可被组/其他人写入,并且在与get_resource_filename一起使用时容易受到攻击。考虑更安全的位置(使用.set_extraction_path或PYTHON_EGG_CACHE环境变量进行设置)。 
warnings.warn(msg,UserWarning)
Traceback(最近一次调用最后一次):
在< module>文件中的第8行hs2.py
database ='default')as conn:
文件build / bdist.linux-x86_64 / egg / pyhs2 / __ init__.py,第7行,连接
文件build / bdist .linux-x86_64 / egg / pyhs2 / connections.py,第46行,在__init__
文件build / bdist.linux-x86_64 / egg / pyhs2 / cloudera / thrift_sasl.py,第66行,打开
thrift.transport.TTransport.TTransportException:无法启动SASL:sasl_client_start(-4)中的错误SASL(-4):没有机制可用:找不到合适的机制

以下是配置单元日志:

 错误[HiveServer2- Handler-Pool:Thread-31]:server.TThreadPoolServer(TThreadPoolServer.java:run(296)) - 处理消息期间发生错误。 
java.lang.RuntimeException:org.apache.thrift.transport.TSaslTransportException:流中没有数据或没有sasl数据
位于org.apache.thrift.transport.TSaslServerTransport $ Factory.getTransport(TSaslServerTransport。 java:219)
at org.apache.thrift.server.TThreadPoolServer $ WorkerProcess.run(TThreadPoolServer.java:268)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)$ b $在java.lang.Thread.run(Thread.java:745)
导致:org .apache.thrift.transport.TSaslTransportException:流中没有数据或没有sasl数据
位于org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:328)
位于org.apache。 thrift.transport.TSaslServerTransport.open(TSaslServerTransport.java:41)
at org.apache.thrift.transport.TSaslServerTransport $ Factory.getTransport(TSaslServerTransport.java: 216)

有人可以帮助解决问题吗?


操作系统版本: Ubuntu 14.04.1

Hive版本:apache-hive-1.2.0 <
SASL版本:sasl-0.1.3

Thrift版本:thrift-0.9.1

解决方案

您缺少一些依赖关系,请确保您安装了 cyrus-sasl-devel cyrus-sasl-gssapi



在基于RHEL的发行版上:

sudo yum install cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain



...或在基于Debian的发行版中:
$ b $ p $ sudo apt-get install sasl2-bin libsasl2-2 libsasl2-dev libsasl2-modules libsasl2-modules-gssapi-mit 包。


I have tried use the example on https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2 but gets the following errors:

/usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/dsnadmin/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
  warnings.warn(msg, UserWarning)
Traceback (most recent call last):
  File "hs2.py", line 8, in <module>
    database='default') as conn:
  File "build/bdist.linux-x86_64/egg/pyhs2/__init__.py", line 7, in connect
  File "build/bdist.linux-x86_64/egg/pyhs2/connections.py", line 46, in __init__
  File "build/bdist.linux-x86_64/egg/pyhs2/cloudera/thrift_sasl.py", line 66, in open
thrift.transport.TTransport.TTransportException: Could not start SASL: Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found

Here is the hive log:

ERROR [HiveServer2-Handler-Pool: Thread-31]: server.TThreadPoolServer (TThreadPoolServer.java:run(296)) - Error occurred during processing of message.
java.lang.RuntimeException: org.apache.thrift.transport.TSaslTransportException: No data or no sasl data in the stream
        at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:219)
        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:268)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.thrift.transport.TSaslTransportException: No data or no sasl data in the stream
        at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:328)
        at org.apache.thrift.transport.TSaslServerTransport.open(TSaslServerTransport.java:41)
        at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:216)

Does anyone can help solve the problem? Thank you very much.

OS version: Ubuntu 14.04.1
Hive version: apache-hive-1.2.0
SASL version: sasl-0.1.3
Thrift version: thrift-0.9.1

解决方案

You are missing some dependencies, make sure you install cyrus-sasl-devel and cyrus-sasl-gssapi:

On an RHEL-based distro:

sudo yum install cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain

... or on a Debian-based distro:

sudo apt-get install sasl2-bin libsasl2-2 libsasl2-dev libsasl2-modules

Per @KenKennedy, also add the libsasl2-modules-gssapi-mit package if using GSSAPI for authentication.

这篇关于python无法连接hiveserver2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆