PyHive挂在连接上 - Thrift_sasl似乎是个问题

时间:2015-02-10 22:52:09

标签: python python-2.7 hive thrift

from pyhive import hive
import thrift_sasl
connection = hive.Connection(host='myhost', port=10000, database='local')
#hangs here

from sqlalchemy import create_engine
engine = create_engine('hive://myhost:10000/local')
logs = Table('mytable', MetaData(bind=engine), autoload=True)
#also hangs here

这两个片段都会为我挂起。

点击ctrl + c会停止执行:

^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/apps/Python/lib/python2.7/site-packages/pyhive/hive.py", line 86, in __init__
self._transport.open()
File "thrift_sasl.py", line 74, in open
status, payload = self._recv_sasl_message()
File "thrift_sasl.py", line 92, in _recv_sasl_message
header = self._trans.readAll(5)
File "/apps/Python/lib/python2.7/site-packages/thrift/transport/TTransport.py", line 58, in readAll
chunk = self.read(sz - have)
File "/apps/Python/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 105, in read
buff = self.handle.recv(sz)
KeyboardInterrupt

我正在使用Hive 0.12和HiveServer2。我可以使用随Hadoop(... / hive / lib / py)提供的python Hive库连接到它,但不能使用pyhive,它使用thrift_sasl。

有些人没有使用thrift_sasl模块建议通过以下方式关闭hive-site.xml中的SASL支持:

<property><name>hive.server2.authentication</name><value>NOSASL</value></property>

然而,在尝试此操作后,当我发出KeyboardInterrupt时,代码仍然挂起了相同的堆栈跟踪。

0 个答案:

没有答案