python - PyHive 连接错误 - 无法启动 SASL
问题描述
我正在尝试使用 PyHive 连接到 Hive 服务器。到目前为止,我有这个:
from pyhive import hive
import pandas as pd
# Create Hive connection
conn = hive.Connection(host="*********", port=10000, auth='NONE')
df = pd.read_sql("select max_temperature_f from `201402_weather_data` LIMIT 10", conn)
print(df.head())
在我的 hive-site.xml 配置中,我有这个:
<property>
<name>hive.server2.authentication</name>
<value>NONE</value>
<final>false</final>
<source>programmatically</source>
<source>org.apache.hadoop.hive.conf.LoopingByteArrayInputStream@56f71edb</source>
</property>
和
<property>
<name>hive.server2.transport.mode</name>
<value>binary</value>
<final>false</final>
<source>programmatically</source>
<source>org.apache.hadoop.hive.conf.LoopingByteArrayInputStream@56f71edb</source>
</property>
根据我的阅读,这些是我可以连接到配置单元服务器的正确设置(假设我想要 NONE 进行身份验证)。执行脚本我得到一个错误:
Traceback (most recent call last):
File "D:/****/hive_connector.py", line 8, in <module>
auth='NONE')
File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyhive\hive.py", line 192, in __init__
self._transport.open()
File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\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: Unable to find a callback: 2'
我使用的是 Windows,所以我不得不手动下载并安装 SASL - sasl-0.2.1-cp37-cp37m-win32.whl
我在用着:
PyHive - 0.6.3, sasl - 0.2.1, thrift - 0.13.0, thrift-sasl - 0.4.2, thriftpy2 - 0.4.11(不知道从何而来)
我看到了很多问题,并且尝试了几件事,但我无法成功运行脚本。你能指出正确的解决方案吗?是导致问题的 sasl 包吗?
解决方案
推荐阅读
- matlab - V-cycle Multigrid Poisson Matlab实现的伪代码
- javascript - 无法在 elenctron 上执行 cause=exit status 1 errorOut
- asp.net-mvc - 如何将日期时间从 API 传递到 postgresql db,后者接收没有区域时间的时间戳?
- python-2.7 - 无法为 PyPy2.7 安装 opencv-python
- operating-system - 文件格式是否独立于系统的字节序?
- python - 你没有权限使用这个命令 Discord.py 重写
- assembly - 为什么当我使用立即值打印整数时它工作正常,但如果我尝试打印包含整数的标签它不打印任何东西?
- fortran - 执行带有阶跃校正的 Runge-Kutta 方法时的无限循环
- python - 如何解决特定字段.E304错误
- grep - Grep 查找以 " 后跟 10 位数字 ","" 开头的行