python-happybase / happybase

A developer-friendly Python library to interact with Apache HBase
https://happybase.readthedocs.io/
Other
611 stars 163 forks source link

TTransportException: TTransportException(type=4, message='TSocket read 0 bytes') #247

Closed mohamedniyaz1996 closed 3 years ago

mohamedniyaz1996 commented 3 years ago

I tried to connect to remote Datanode of HBase cluster of version 2.1.0-chd6.2.1 like below:

import happybase
connection = happybase.Connection("10.22.151.68")
print(connection.tables())

But I am getting below error message:

TTransportException: TTransportException(type=4, message='TSocket read 0 bytes')

But with Hbase version of 0.98.6-cdh5.3.0 it is printing tables properly. Please help me to figure out why it is not connecting to new version of HBase.

mohamedniyaz1996 commented 3 years ago

I tried using below block and it started working:

import happybase
connection = happybase.Connection("10.22.151.68",port=9090,transport="framed",protocol="compact")
print(connection.tables())

At newer version of HBase-2.1.0 , protocol had been modified to compact from binary which is set as default-value at happybase - Connection object

wbolster commented 3 years ago

good to hear you figured it out, and also came back to describe the fix :+1:

mohamedniyaz1996 commented 3 years ago

It's my pleasue! Please add on the official PyPI docs about this as users would be reading much on README.md/ PyPI official documentation.

wbolster commented 3 years ago

pull requests welcome :)