http://www.manning.com/dimidukkhurana
The client assumes you have an existing TwitBase schema containing User data. It also requires a running thrift gateway. Start a gateway against your HBase cluster with:
$ hbase thrift start
You also need the Python Thrift library installed. Installation is
platform-specific, but it's most easily handled through the
easy_install
utility:
$ sudo easy_install thrift==0.8.0
Launching the client is then as simple as:
$ ./TwitBase.py list
You can also interact with the embedded HBase client from within an interactive python session. For instance, you can list the available HBase tables like this:
$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
...
>>> from thrift.transport import TSocket
>>> from thrift.protocol import TBinaryProtocol
>>> from hbase import Hbase
>>> transport = TSocket.TSocket('localhost', 9090)
>>> protocol = TBinaryProtocol.TBinaryProtocol(transport)
>>> client = Hbase.Client(protocol)
>>> transport.open()
>>> client.getTableNames()
['followers', 'twits', 'users']
Copyright (C) 2012 Nick Dimiduk, Amandeep Khurana
Distributed under the Apache License, version 2.0, the same as HBase.