在Http模式下通过Thrift服务器连接到HBase的Python程序 [英] Python program to connect to HBase via thrift server in Http mode

查看:145
本文介绍了在Http模式下通过Thrift服务器连接到HBase的Python程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个简单的程序以节俭方式连接到HBase服务器,该节俭以Http模式启动(集群已进行kerberized),但我始终会收到``读取零字节错误消息''

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'

我已经参考了以下链接,但是仅当节俭服务器以二进制模式(??)启动时,这些示例才有效 https://github.com/joshelser/hbase-thrift1 -python-sasl/blob/master/get_row.py

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,

我做了Klist和Kinit,一切看起来都很好,而且我遵循了以下HDP文档,并且我的设置正确

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主机9090 hbase true

hbase org.apache.hadoop.hbase.thrift.HttpDoAsClient host 9090 hbase true

任何对通过节俭的http模式连接到HBase的示例代码的引用都非常感谢

any reference to sample code to connect to HBase through thrift http mode is greatly appreciated

谢谢

推荐答案

错误读取0字节"是非常通用的消息,当服务器获取异常时出现.更好地检查节俭服务器日志以获取确切的错误消息堆栈跟踪.如果未生成日志,则需要设置到服务器端的最小日志记录.

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)

您可能还需要增加hbase.thrift.server.socket.read.timeout来保持连接打开以达到最佳处理时间.

You might also need to increase hbase.thrift.server.socket.read.timeout to keep the connection open for optimal processing time.

您可以在此处.

这篇关于在Http模式下通过Thrift服务器连接到HBase的Python程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆