gpt4 book ai didi

python - Python 2.6.6和 hive 连接问题?

转载 作者:行者123 更新时间:2023-12-02 21:10:15 24 4
gpt4 key购买 nike

我有一个默认Python版本2.6.6和hive 1.2的VM。我已经成功安装了pyhs2。但是,当我运行python脚本时,出现以下错误。

File "test.py", line 7, in <module>
with pyhs2.connect(host='localhost', port=10000, authMechanism="PLAIN", user='hive', password='hive', database='xxxx') as conn:
File "/usr/lib/python2.6/site-packages/pyhs2/__init__.py", line 7, in connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/pyhs2/connections.py", line 46, in __init__
transport.open()
File "/usr/lib/python2.6/site-packages/pyhs2/cloudera/thrift_sasl.py", line 55, in open
self._trans.open()
File "/usr/lib64/python2.6/site-packages/thrift/transport/TSocket.py", line 101, in open
message=message)
thrift.transport.TTransport.TTransportException: Could not connect to localhost:10000

在我的hive-site.xml中,我具有以下配置。
<property>
<name>hive.server2.authentication</name>
<value>NONE</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
</property>

当我使用以下脚本时:
with pyhs2.connect(host='localhost', port=10000, authMechanism="NONE", user='hive', password='hive', database='xxxx') as conn:

我收到以下错误:
NotImplementedError: authMechanism is either not supported or not implemented.

请帮忙!

请注意,客户端不允许我升级python版本或更改Hive中的身份验证机制。

提前致谢。

最佳答案

1)检查此https://github.com/BradRuderman/pyhs2/blob/master/pyhs2/connections.py

authMechanisms = set(['NOSASL', 'PLAIN', 'KERBEROS', 'LDAP'])

authMechanisms应该是其中之一

2) thrift.transport.TTransport.TTransportException: Could not connect to localhost:10000错误
键入 netstat -a -n | grep 10000并检查服务是否在端口10000上侦听

关于python - Python 2.6.6和 hive 连接问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40481716/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com