首页 文章

从Python和happybase / Thrift连接到Hbase

提问于
浏览
0

我安装了Cloudera Manager Express 5.9.0安装HBase,Thrift服务器在VirtualBox vm上的CentOS 7.3上的端口9090上运行 .

请帮助弄清楚为什么我无法通过happybase成功连接,或帮助确定后续步骤 .

我是一名经验丰富的Java程序员,学习Python . 我有使用本机界面从Java使用Hbase的经验,尽管不在此特定环境中 .

  • 我已经验证我可以使用hbase shell创建表,插入数据等 .

  • 我已经验证9090(节俭)正在倾听并接受连接 .

  • 我想我已经验证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

任何帮助是极大的赞赏 . 谢谢 .

2 回答

相关问题