[英]Connecting to hive from windows using pyhive and pyodbc
嗨,我想使用 python 庫 pyhive 和 pyodbc 連接到 hive:
conn = hive.Connection(host="hostname",port=10001,username="********",database="default",auth='KERBEROS',kerberos_service_name="hive")
我得到的錯誤
TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'
當我使用 pyodbc 然后
conn_string="""DSN=%s; Host=%s, Port=%d, Database=default; AuthMech=3;UseSASL=1; UID=%s; PWD=%s; SSL=1;AllowSelfSignedServerCert=1"""% (cfg['DSN'], cfg['host'], cfg['port'],cfg['username'], cfg['password'])
conn = pyodbc.connect(conn_string, autocommit=True)
這是我遇到的錯誤,請如果有人成功通過pyodbc,pyhive將python與hive連接,請幫助
Hive 托管在 Cloudera 中。
pyhive 需要 sasl 依賴項
在 linux 上通過 yum/apt 安裝
在windows上安裝cyrus-sasl包后,需要配置sasl2目錄
位於site-packages/sasl
或Library/bin/
方法一:復制sasl2文件夾到C:\\CMU\\bin\\
方法二:添加注冊表字符串
HKEY_LOCAL_MACHINE\SOFTWARE\Carnegie Mellon\Project Cyrus\SASL Library\SearchPath
C:\Users\cdarling\Miniconda3\envs\hive\Library\bin\sasl2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.