0

我正在尝试使用 python 2(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”,不确定为什么会出现此错误。谢谢你的帮助。

4

1 回答 1

0

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

import pyhs2

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

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

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

于 2016-09-26T19:57:24.320 回答