TSocket read 0 bytes - happybase version 0.8

2019-09-05 14:32发布

问题:

I'm trying to connect hbase by happybase framework version 0.8.

I've started daemon thrift - /usr/hdp/current/hbase-master/bin/hbase-daemon.sh start thrift -p 9090

 from happybase.connection import Connection
 DEFAULT_HOST = '10.128.121.13'
 DEFAULT_PORT = 9090
 DEFAULT_TRANSPORT = 'framed'
 DEFAULT_COMPAT = '0.96'`

 cc = Connection(DEFAULT_HOST,DEFAULT_PORT,None,True,None,'_',DEFAULT_COMPAT,DEFAULT_TRANSPORT) print(cc.tables())`

Do I need to start thrift service in all nodes, Hbase master and RegionServers ?

I got this error:

TSocket read 0 bytes

回答1:

If it is a distributed cluster, you don't have to run thrift server of each node individually.

It seems to be issue with instantiation of Connection. Try following :

conn = happybase.Connection( host='DEFAULT_HOST', port='DEFAULT_PORT', protocol='compact' )

You can also have a look in this issue : https://github.com/wbolster/happybase/issues/193