gpt4 book ai didi

python - 指定端口时出现 Impyla 错误

转载 作者:太空宇宙 更新时间:2023-11-03 12:59:10 25 4
gpt4 key购买 nike

如果我在连接中指定端口,我正在使用 impyla 0.9.0

conn = impala.dbapi.connect(host='n1', port=21000)

我会得到以下错误

Traceback (most recent call last):
File "./myquery.py", line 78, in <module>
main(len(sys.argv), sys.argv)
File "./myquery.py", line 58, in main
cur = conn.cursor()
File "/usr/lib/python2.6/site-packages/impala/dbapi/hiveserver2.py", line 55, in cursor
rpc.open_session(self.service, user, configuration))
File "/usr/lib/python2.6/site-packages/impala/_rpc/hiveserver2.py", line 132, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/impala/_rpc/hiveserver2.py", line 214, in open_session
resp = service.OpenSession(req)
File "/usr/lib/python2.6/site-packages/impala/_thrift_gen/TCLIService/TCLIService.py", line 175, in OpenSession
return self.recv_OpenSession()
File "/usr/lib/python2.6/site-packages/impala/_thrift_gen/TCLIService/TCLIService.py", line 191, in recv_OpenSession
raise x
thrift.Thrift.TApplicationException: Invalid method name: 'OpenSession'

但它是一个有效的端口。

impala-shell -i n1:21000
Starting Impala Shell without Kerberos authentication
Connected to n1:21000
Server version: impalad version 2.1.1-cdh5 RELEASE (build 7901877736e29716147c4804b0841afc4ebc9037)
Welcome to the Impala shell. Press TAB twice to see a list of available commands.

Copyright (c) 2012 Cloudera, Inc. All rights reserved.

(Shell build version: Impala Shell v2.1.1-cdh5 (7901877) built on Tue Jan 27 16:23:42 PST 2015)
[n1:21000] >

一旦我删除端口

conn = impala.dbapi.connect(host='n1')

它又工作了。

最佳答案

Impyla 正在尝试使用 HiveServer2 协议(protocol)连接到 Impala,因此您应该使用端口 21050。端口 21000 用于 Beeswax 协议(protocol)(Impala shell 使用)。

关于python - 指定端口时出现 Impyla 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28786564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com