问题
I am trying to write a simple program to connect to HBase server through thrift which is started in Http mode.(cluster is kerberized ) but I always gets 'read zero bytes error message'
I have refered below links but those examples work only if the thrift server starts in Binary mode (??) https://github.com/joshelser/hbase-thrift1-python-sasl/blob/master/get_row.py,
I did Klist and Kinit everything looks fine and also I have followed below HDP documentation and my setup is correct
https://community.hortonworks.com/articles/87655/start-and-test-hbase-thrift-server-in-a-kerberised.html
I was able to list the tables when I run the below command
hbase org.apache.hadoop.hbase.thrift.HttpDoAsClient host 9090 hbase true
any reference to sample code to connect to HBase through thrift http mode is greatly appreciated
thank you
回答1:
Error "read 0 bytes" is very generic message that appear when server gets an exception. Better check thrift server logs to get exact error message stack trace. If logs are not getting generated then you need to set up minimal logging to the server side.
import logging
logging.basicConfig(level=logging.DEBUG)
You might also need to increase hbase.thrift.server.socket.read.timeout
to keep the connection open for optimal processing time.
You can find the sample python code here.
来源:https://stackoverflow.com/questions/52268153/python-program-to-connect-to-hbase-via-thrift-server-in-http-mode