如果我在connect中指定port,那么我使用的是impyla0.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')
它又起作用了。
1条答案
按热度按时间qltillow1#
impyla正在尝试使用hiveserver2协议连接到impala,因此您应该使用端口21050。端口21000用于蜂蜡协议(impala shell使用)。