pyhs2错误连接到启用kerberos的配置单元

iyfamqjs  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(389)

我正在尝试使用python2(miniconda2安装)连接到配置单元。下面是我正在尝试的代码-

connection = hive.connect(host='psvlxihpnn1', port= '10000', authMechanism='KERBEROS', user='***',password='****', configuration={'krb_host': 'psvlxihpnn1', 'krb_service': 'ITEDM'} )

kerberos主机安装在同一台主机上,并且服务名为“itedm”。奇怪的是,我得到下面的错误-

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/export/home/itedm/miniconda2/lib/python2.7/site-packages/pyhs2-0.6.0-py2.7.egg/pyhs2/__init__.py", line 7, in connect
  File "/export/home/itedm/miniconda2/lib/python2.7/site-packages/pyhs2-0.6.0-py2.7.egg/pyhs2/connections.py", line 46, in __init__
  File "/export/home/itedm/miniconda2/lib/python2.7/site-packages/pyhs2-0.6.0-py2.7.egg/pyhs2/cloudera/thrift_sasl.py", line 66, in open
thrift.transport.TTransport.TTransportException: Could not start SASL: Error in sasl_client_start (-1) SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure.  Minor code may provide more information (Server krbtgt/INFORMATICA.COM@ITEDM not found in Kerberos database)

我不是以用户身份传递'krbtgt',不确定为什么会出现此错误。谢谢你的帮助。

goqiplq2

goqiplq21#

只要运行脚本的用户具有有效的kerberos票证,此连接字符串就可以工作:

import pyhs2

with pyhs2.connect(host='beeline_host',
                    port=10000,
                    authMechanism="KERBEROS") as conn:

with conn.cursor() as cur:
        print cur.getDatabases()

用户名、密码和任何其他配置参数都不会通过kdc传递。

相关问题