安装Pyhive需要以下依赖:sasl==0.2.1、thrift==0.13.0、thrift-sasl==0.4.2
以上安装完成后,安装pyhive成功。
导入pyhive包,connection连接hive时,报以下错误:thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xindun/anaconda3/lib/python3.6/site-packages/pyhive/hive.py", line 192, in __init__
self._transport.open()
File "/home/xindun/anaconda3/lib/python3.6/site-packages/thrift_sasl/__init__.py", line 85, in open
message=("Could not start SASL: %s" % self.sasl.getError()))
thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found'
>>> conn = hive.Connection(host='192.168.1.196', port=10000, username='xindun', database='default')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xindun/anaconda3/lib/python3.6/site-packages/pyhive/hive.py", line 192, in __init__
self._transport.open()
File "/home/xindun/anaconda3/lib/python3.6/site-packages/thrift_sasl/__init__.py", line 85, in open
message=("Could not start SASL: %s" % self.sasl.getError()))
thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found'
解决方法:
yum install cyrus-sasl-plain
以上实测后,该问题成功解决。
参考:https://ask.youkuaiyun.com/questions/1705164
在使用Pyhive连接Hive时遇到TTransportException错误,原因是缺少SASL机制。解决方案是通过yum安装cyrus-sasl-plain,安装后问题得到解决。
5627

被折叠的 条评论
为什么被折叠?



