我安装了Cloudera Manager Express 5.9.0安装HBase,Thrift服务器在VirtualBox虚拟机上的CentOS 7.3上的端口9090上运行。
请帮助弄清楚为什么我无法通过happybase成功界面,或帮助确定后续步骤。
我是一名经验丰富的Java程序员,学习Python。我有使用本机接口从Java使用Hbase的经验,但不是在这个特定的环境中。
Python脚本几乎直接来自happybase howto:
import happybase
connection = happybase.Connection(host='localhost',port=9090,transport='buffered', protocol='compact')
connection.create_table('mytable',
{'cf1': dict(max_versions=10),
'cf2': dict(max_versions=1, block_cache_enabled=False),
'cf3': dict(), # use defaults
}
)
错误消息,我找不到很好的参考:
[root@data1 ~]# python testhbase.py
Traceback (most recent call last):
File "testhbase.py", line 10, in <module> 'cf3': dict(), # use defaults
File "build/bdist.linux-x86_64/egg/happybase/connection.py", line 311, in create_table
File "/usr/lib64/python2.7/site-packages/thriftpy/thrift.py", line 198, in _req return self._recv(_api)
File "/usr/lib64/python2.7/site-packages/thriftpy/thrift.py", line 210, in _recv fname, mtype, rseqid = self._iprot.read_message_begin()
File "/usr/lib64/python2.7/site-packages/thriftpy/protocol/compact.py", line 147, in read_message_begin % proto_id)
thriftpy.protocol.exc.TProtocolException: TProtocolException(type=4)
[root@data1 ~]#
我在端口9095上运行Thift Web服务管理器报告:
HBase Version 1.2.0-cdh5.9.0, rUnknown HBase version and revision
Thrift Impl Type threadpool Thrift RPC engine implementation type chosen by this Thrift server
Compact Protocol true Thrift RPC engine uses compact protocol
Framed Transport false Thrift RPC engine uses framed transport
非常感谢任何帮助。谢谢。
答案 0 :(得分:1)
我猜你没有使用受支持的thrift守护程序版本。
你确定使用了thrift 1(不是thrift2)守护进程,使用正确的协议和传输吗?
答案 1 :(得分:0)
Happybase仅支持Thrift1。
对于使用Thrift2对hbase的python支持,试试这个: https://github.com/apache/hbase/blob/master/hbase-examples/src/main/python/thrift2/DemoClient.py
答案 2 :(得分:0)
我遇到了同样的问题,花了40多个小时后,我才在Cloudera VM中发现了这个问题:
settings->network->advance->port forwarding
您需要添加新的端口9090和9095(可选)以使其工作。
由于某些原因,Cloudera映像中默认未添加此端口