我已经安装了 Cloudera Manager Express 5.9.0 并安装了 HBase,Thrift 服务器在 VirtualBox vm 中的 CentOS 7.3 上的端口 9090 上运行。
请帮助找出我无法通过happybase 成功连接的原因,或帮助确定接下来要采取的步骤。
我是一名经验丰富的 Java 程序员,正在学习 Python。我有使用本地接口从 Java 使用 Hbase 的经验,尽管不是在这个特定的环境中。
- 我已经验证我可以使用 hbase shell 来创建表、插入数据等。
- 我已经验证 9090 (thrift) 正在侦听和接受连接。
- 我想我已经验证了 Thrift 服务器正在使用与 happybase 连接参数相同的协议/传输设置运行。
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
任何帮助是极大的赞赏。谢谢你。