0

我能够连接到我的 hbase

    connection = happybase.Connection(host='node-04',port=16000)
    table = connection.table('test')

这两个命令可以正常工作。但是当我运行下面的 cammand 我得到以下错误

    print connection.tables()
    error                                     
    Traceback (most recent call last)
    <ipython-input-49-de0848d7286f> in <module>()
    ----> 1 print connection.tables()

    /root/anaconda2/lib/python2.7/site-packages/happybase/connection.pyc in                 tables(self)
    236         :rtype: List of strings
237         """
    --> 238         names = self.client.getTableNames()
239 
240         # Filter using prefix, and strip prefix from names

    /root/anaconda2/lib/python2.7/site-packages/happybase/hbase/Hbase.pyc in getTableNames(self)
815     @return returns a list of names
816     """
    --> 817     self.send_getTableNames()
818     return self.recv_getTableNames()
819 

    /root/anaconda2/lib/python2.7/site-packages/happybase/hbase/Hbase.pyc in send_getTableNames(self)
823     args.write(self._oprot)
824     self._oprot.writeMessageEnd()
    --> 825     self._oprot.trans.flush()
826 
827   def recv_getTableNames(self, ):

    /root/anaconda2/lib/python2.7/site-packages/thrift/transport/TTransport.pyc in flush(self)
172     # reset wbuf before write/flush to preserve state on underlying failure
173     self.__wbuf = StringIO()
    --> 174     self.__trans.write(out)
175     self.__trans.flush()
176 

    /root/anaconda2/lib/python2.7/site-packages/thrift/transport/TSocket.pyc in write(self, buff)
128     have = len(buff)
129     while sent < have:
    --> 130       plus = self.handle.send(buff)
131       if plus == 0:
132         raise TTransportException(type=TTransportException.END_OF_FILE,

    error: [Errno 32] Broken pipe

我正在使用Hbase 版本:1.1.2.2.3.4.0-3485

如果您可以建议任何我可以用来使用 python 为 hbase 编码的包,请提供帮助

4

1 回答 1

1

happybase 要求您连接到 thrift 守护程序,您需要在您的 hbase 集群上启动它。happybase 不直接连接到 hbase 节点。

从端口号来看,您不是连接到 thrift(默认使用端口 9090),而是连接到 hbase master。这不是happybase 的工作方式。

于 2016-07-21T08:42:49.690 回答