首页 > 解决方案 > Python 程序以 Http 模式通过 Thrift 服务器连接到 HBase

问题描述

我正在尝试编写一个简单的程序来通过以 Http 模式启动的 thrift 连接到 HBase 服务器。(集群是 kerberized )但我总是收到“读取零字节错误消息”

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

我做了 Klist 和 Kinit 一切看起来都很好,我也遵循了 HDP 文档,我的设置是正确的

https://community.hortonworks.com/articles/87655/start-and-test-hbase-thrift-server-in-a-kerberised.html

当我运行以下命令时,我能够列出表格

hbase org.apache.hadoop.hbase.thrift.HttpDoAsClient 主机 9090 hbase true

非常感谢任何对通过 thrift http 模式连接到 HBase 的示例代码的参考

谢谢你

标签: pythonhbasekerberosthrifthdp

解决方案


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.


推荐阅读