当前位置: 首页 > 工具软件 > pyhs > 使用案例 >

linux 测试pyhs2,如何使用python pyhs2连接到配置单元?

晋天逸
2023-12-01

我正在尝试使用pyhs2访问蜂巢.我尝试了以下代码:

example.py

import pyhs2

conn = pyhs2.connect(host='localhost', port=10000,authMechanism=None, user=None, password=None,database='default')

with conn.cursor() as cur:

cur.execute("select * from table")

for i in cur.fetch():

print i

我收到以下错误:

Traceback (most recent call last):

File "example.py", line 2, in conn = pyhs2.connect(host='localhost', port=10000,authMechanism=None, user=None, password=None,database='default')

File "build/bdist.linux-x86_64/egg/pyhs2/__init__.py", line 7, in connect

File "build/bdist.linux-x86_64/egg/pyhs2/connections.py", line 46, in __init__

File "build/bdist.linux-x86_64/egg/pyhs2/cloudera/thrift_sasl.py", line 55, in open

File "build/bdist.linux-x86_64/egg/thrift/transport/TSocket.py", line 101, in open

thrift.transport.TTransport.TTransportException: Could not connect to localhost:10000

当我尝试蜂巢工具时,我得到确切的错误.我检查了sasl安装.我是否需要对hive中的hive-site.xml进行任何更改?如果是,我需要在哪里创建它?我错过了什么吗?

 类似资料: