0

I am able to connect with my hbase

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

These 2 commands work without any error. but when I run the below cammand i am getting following error

    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

I am usingHbase version:1.1.2.2.3.4.0-3485

Please help if you can suggest any package which i can use to code for hbase using python

Rohit Raj
  • 1
  • 3

1 Answers1

1

happybase requires you to connect to the thrift daemon, which you need to start on your hbase cluster. happybase does not connect to hbase nodes directly.

judging from the port number, you are not connecting to thrift (uses port 9090 by default) but to the hbase master. this is not how happybase works.

wouter bolsterlee
  • 3,879
  • 22
  • 30
  • I have already installed the thrift daemon and its running but that too dosent seen to resolve the issue. It seems to be the issue from happybase. So i am finally doing my work in scala – Rohit Raj Jul 25 '16 at 08:10
  • 1
    you are using `happybase.Connection(host='node-04',port=16000)` so it looks you're not connecting to the thrift daemon, but to the hbase master process. as i said, you need to connect to thrift, which listens on port 9090 by default. – wouter bolsterlee Jul 28 '16 at 09:26