The document discusses the HBase client API for connecting to HBase clusters from applications like webapps. It describes the Java, Ruby, Python, and Thrift client interfaces as well as examples of using scans and puts with these interfaces. It also briefly mentions the REST client interface and some other alternative client libraries like asynchbase and Orderly.
6. Java client Interfaces
• Configuration holds details where to find the cluster and tunable
settings. Roughly equivalent to JDBC connection string.
• HConnection represents connections to to the cluster.
• HBaseAdmin handles DDL operations (create, list, drop, alter, &c.)
• HTablePool connection pool for table handles.
• HTable (HTableInterface) is a handle on a single HBase table.
Send "commands" to the table (Put, Get, Scan, Delete, Increment)
6
7. Java client Example
public static final byte[] TABLE_NAME = Bytes.toBytes("twits");
public static final byte[] TWITS_FAM = Bytes.toBytes("twits");
public static final byte[] USER_COL = Bytes.toBytes("user");
public static final byte[] TWIT_COL = Bytes.toBytes("twit");
private HTablePool pool = new HTablePool();
https://github.com/hbaseinaction/twitbase/blob/master/src/main/java/HBaseIA/TwitBase/hbase/TwitsDAO.java#L23-L30
7
18. Thrift client Example
def user_from_row(row):
user = {}
for col,cell in row.columns.items():
user[col[5:]] = cell.value
return "<User: {user}, {name}, {email}>".format(**user)
https://github.com/hbaseinaction/twitbase.py/blob/master/TwitBase.py#L26-L30
18
19. REST client Interface
1. Stand up a "REST Gateway" between your application and the cluster
2. HTTP verbs translate (roughly) into table commands
3. decent support for basic DDL, HTable operations
19
32. Software Architecture
• Isolate DAO from app logic, separation of concerns, &c.
• Separate environment configs from code.
• Watch out for resource contention.
32
34. HBase Warts
• Know thy (HBase) version 0.{92,94,96} !
• long-running client bug (HBASE-4805).
• Gateway APIs only as up to date as the people before you require.
• REST API particularly unpleasant for “Web2.0” folk.
34
35. Thanks!
Nick Dimiduk
github.com/ndimiduk
@xefyr
Nick Dimiduk
Amandeep Khurana
n10k.com
FOREWORD BY
Michael Stack
MANNING
hbaseinaction.com
35