欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

pyhive 安装测试及问题解决

发布时间:2023/12/31 56 豆豆
生活随笔 收集整理的这篇文章主要介绍了 pyhive 安装测试及问题解决 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

pyhive 安装测试及问题解决

1.排除安装包是否冲突

由于我安装了anaconda,所以conda下载的包和pip下载的包可能导致冲突,使用conda list查看包,我这里为了干净,将conda可能重复的全部卸载了

conda uninstall sasl conda uninstall thrift_sasl conda uninstall thrift conda uninstall pyhive

2.安装工具包

由于我是在windows环境下的conda环境,不能直接pip install sasl,就算安装上也不能使用,先到这里【https://www.lfd.uci.edu/~gohlke/pythonlibs/】下载win对应sasl的.whl安装文件到本地
下载我python3.8对应的版本:

就保存到本地桌面吧:

cd到桌面目录安装:

pip install wheel pip install sasl-0.3.1-cp38-cp38-win_amd64.whl


其他包正常安装即可:

pip install thrift pip install thrift_sasl pip install pyhive

3.测试

from pyhive import hive conn = hive.Connection(host='node001',port=10000,username='hive') cursor = conn.cursor() cursor.execute('show tables') for result in cursor.fetchall():print(result)


如果要连接kerberos认证的hive:

conn = hive.Connect(host='XXXX',port=10000,auth='KERBEROS',kerberos_service_name="hive")

4.错误解决

4.1 sasl报错:

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’
everything找到saslPLAIN.dll文件,并复制到C:\CMU\bin\sasl2\目录下,这个目录自行创建。

4.2 hive权限错误

使用hive用户,报hive没有/tmp目录权限错误,具体错误懒得回去截图了,给/tmp目录授权给所有用户,反正是我自己玩,没关系

hadoop fs -chmod -R 777 /tmp

还有一点是之前我已经修改了core-site.xml配置

vim $HADOOP_HOME/etc/hadoop/sore-site.xml

添加配置

<property><name>hadoop.proxyuser.root.hosts</name><value>*</value></property><property><name>hadoop.proxyuser.root.groups</name><value>*</value></property>

总结

以上是生活随笔为你收集整理的pyhive 安装测试及问题解决的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。