cloudera / impyla

Python DB API 2.0 client for Impala and Hive (HiveServer2 protocol)
Apache License 2.0
727 stars 249 forks source link

Thrift error connecting to cdh 5.4 #73

Closed lordjc closed 9 years ago

lordjc commented 9 years ago

Using impyla 0.9.1 -> cdh 5.4 (hiveserver2) I am getting socket timeout....

Getting the following thrift error: File "/Users/jlord/cops/exphdfs.py", line 30, in cursor = conn.cursor() File "/Users/jlord/anaconda/lib/python2.7/site-packages/impyla-0.9.1-py2.7.egg/impala/dbapi/hiveserver2.py", line 55, in cursor rpc.open_session(self.service, user, configuration)) File "/Users/jlord/anaconda/lib/python2.7/site-packages/impyla-0.9.1-py2.7.egg/impala/_rpc/hiveserver2.py", line 132, in wrapper return func(_args, *_kwargs) File "/Users/jlord/anaconda/lib/python2.7/site-packages/impyla-0.9.1-py2.7.egg/impala/_rpc/hiveserver2.py", line 214, in open_session resp = service.OpenSession(req) File "/Users/jlord/anaconda/lib/python2.7/site-packages/impyla-0.9.1-py2.7.egg/impala/_thrift_gen/TCLIService/TCLIService.py", line 175, in OpenSession return self.recv_OpenSession() File "/Users/jlord/anaconda/lib/python2.7/site-packages/impyla-0.9.1-py2.7.egg/impala/_thrift_gen/TCLIService/TCLIService.py", line 186, in recv_OpenSession (fname, mtype, rseqid) = self._iprot.readMessageBegin() File "build/bdist.macosx-10.5-x86_64/egg/thrift/protocol/TBinaryProtocol.py", line 140, in readMessageBegin File "build/bdist.macosx-10.5-x86_64/egg/thrift/transport/TTransport.py", line 58, in readAll File "build/bdist.macosx-10.5-x86_64/egg/thrift/transport/TTransport.py", line 159, in read File "build/bdist.macosx-10.5-x86_64/egg/thrift/transport/TSocket.py", line 105, in read socket.timeout: timed out

Than from the hiverserver2 log:

7:21:32.041 PM ERROR org.apache.thrift.server.TThreadPoolServer
Error occurred during processing of message. java.lang.RuntimeException: org.apache.thrift.transport.TTransportException: Invalid status -128 at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:219) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:268) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.thrift.transport.TTransportException: Invalid status -128 at org.apache.thrift.transport.TSaslTransport.sendAndThrowMessage(TSaslTransport.java:232) at org.apache.thrift.transport.TSaslTransport.receiveSaslMessage(TSaslTransport.java:184) at org.apache.thrift.transport.TSaslServerTransport.handleSaslStartMessage(TSaslServerTransport.java:125) at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:271) at org.apache.thrift.transport.TSaslServerTransport.open(TSaslServerTransport.java:41) at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:216) ... 4 more

ex:

conn = connect(host='lannister-002.edh.cloudera.com',port=10000) cursor = conn.cursor() cursor.execute('SELECT * FROM test_customer_logs LIMIT 100') print cursor.description # prints the result set's schema results = cursor.fetchall()

laserson commented 9 years ago

Sorry to hear that. I'm not sure it's a CDH 5.4 issue, as I have successfully connected to CDH5.4 and a CDH5.5 cluster internally. Did this problem only start after upgrade? Is it possible the port numbers have been changed back to the defaults during the upgrade?

lordjc commented 9 years ago

Thanks for the speedy reply Uri. This is what we have in our hive-site.xml

hive.server2.thrift.port 10000

Good to know its also working on CDH 5.4, that would imply that its likely something local on my machine than.

On Wed, Apr 29, 2015 at 10:41 PM, Uri Laserson notifications@github.com wrote:

Sorry to hear that. I'm not sure it's a CDH 5.4 issue, as I have successfully connected to CDH5.4 and a CDH5.5 cluster internally. Did this problem only start after upgrade? Is it possible the port numbers have been changed back to the defaults during the upgrade?

— Reply to this email directly or view it on GitHub https://github.com/cloudera/impyla/issues/73#issuecomment-97638346.

laserson commented 9 years ago

Ah, it appears you're trying to connect to Hive rather than Impala. Both Impala and Hive implement HiveServer2, and impyla doesn't connect to the Hive version (which I agree is strange). You need to find the port that Impala is exposing for HiveServer2. Typically, CDH sets this to 21050.

lordjc commented 9 years ago

Ok its working now. Thanks! Just left out the port and it hit the default.

On Wed, Apr 29, 2015 at 10:53 PM, Uri Laserson notifications@github.com wrote:

Ah, it appears you're trying to connect to Hive rather than Impala. Both Impala and Hive implement HiveServer2, and impyla doesn't connect to the Hive version (which I agree is strange). You need to find the port that Impala is exposing for HiveServer2. Typically, CDH sets this to 21050.

— Reply to this email directly or view it on GitHub https://github.com/cloudera/impyla/issues/73#issuecomment-97642996.

laserson commented 9 years ago

No problem!