Python program to connect to HBase via thrift server in Http mode
Asked Answered
F

1

9

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

Fogdog answered 11/9, 2018 at 3:14 Comment(0)
K
2

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.

Kamerman answered 19/9, 2018 at 11:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.