Thrift Hbase Python-> thrift.transport.TTransport.TTransportException:TSocket读取0个字节

时间:2019-04-02 20:06:40

标签: python hadoop hbase thrift happybase

为什么无法建立连接并导致 thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

我正在尝试使用thrift从python连接到hbase。我正在cloudera cdh5.14集群上工作,并且节俭服务器正在集群上运行。 hbase版本1.2.0

已经三个星期了,我已经尝试了以下方法: 通过搜索,我有点知道它与节俭有关,而与python,happybase或hbase无关。它是一个kerberized集群,并且已按照第一个链接中所述更改了协议和传输模式: 我想如果也使用happybase,该解决方案也应该有效。 1)Cloudera/CDH v6.1.x + Python HappyBase v1.1.0: TTransportException(type=4, message='TSocket read 0 bytes')

2)TSocket read 0 bytes - happybase version 0.8

3)thrift timeout for long run call: thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

4)TSocket read 0 bytes accessing hive with python

5)TTransportException: TSocket read 0 bytes while accessing Hive via Python

6)python thrift error ```TSocket read 0 bytes```

7)Uncaught exception 'TTransportException' with message 'TSocket read 0 bytes'

8)TSocket read 0 bytes Apache Thrift MongoDB

from thrift.transport import TSocket
from thrift.protocol import TCompactProtocol
from thrift.transport.TTransport import TFramedTransport
from hbase import Hbase


(host, port) = ("cluster.hostname", 9090)
transport = TFramedTransport(TSocket.TSocket(host, port))
protocol = TCompactProtocol.TCompactProtocol(transport)
client = Hbase.Client(protocol)

transport.open()
print(client.getTableNames())

错误摘要与上述链接中的大多数相似

Traceback (most recent call last):
  File "testing.py", line 14, in <module>
    print(client.getTableNames())
  File "/home/caston/final_attempt/gen-py/hbase/Hbase.py", line 786, in getTableNames
    return self.recv_getTableNames()
  File "/home/caston/final_attempt/gen-py/hbase/Hbase.py", line 796, in recv_getTableNames
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
  File "/usr/lib64/python2.7/site-packages/thrift/protocol/TCompactProtocol.py", line 310, in readMessageBegin
    proto_id = self.__readUByte()
  File "/usr/lib64/python2.7/site-packages/thrift/protocol/TCompactProtocol.py", line 289, in __readUByte
    result, = unpack('!B', self.trans.readAll(1))
  File "/usr/lib64/python2.7/site-packages/thrift/transport/TTransport.py", line 58, in readAll
    chunk = self.read(sz - have)
  File "/usr/lib64/python2.7/site-packages/thrift/transport/TTransport.py", line 276, in read
    self.readFrame()
  File "/usr/lib64/python2.7/site-packages/thrift/transport/TTransport.py", line 280, in readFrame
    buff = self.__trans.readAll(4)
  File "/usr/lib64/python2.7/site-packages/thrift/transport/TTransport.py", line 58, in readAll
    chunk = self.read(sz - have)
  File "/usr/lib64/python2.7/site-packages/thrift/transport/TSocket.py", line 120, in read
    message='TSocket read 0 bytes')
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

任何帮助将不胜感激!

0 个答案:

没有答案