Best HBase Client API for Java

Im working on a project in which I have to use hbase. The project is in Java. I need to know what is the best hbase api client for java.

+5
source share
5 answers

HBase has its own Java client in the core library. It covers almost everything. (There is also a connection). If you need an asynchronous client, you can check asyncbase from stumbleupon, which is a reliable client. But filter support is limited (it has basic filters, although they work like a charm). If you use java, I would not recommend using it through relaxation.

+7

Kundera - . .

+6

Kundera - - Hbase Cassandra MongoDB.

:

  • JPA 2.0.
  • / lucene.
  • JPA.

: https://github.com/impetus-opensource/Kundera

+2

playOrm - Java, . JPA, nosql . , findAll(), , nosql.

playOrm JQL, nosql.... 1 JQL . noSql , JPA.

+1

HBaseExecutor, Java- HBase. Java HBase, HBaseExecutor :

  • // API (CRUD) /.
  • / .

HBaseExecutor

Account account = createAccount();

// Insert is supported by Model/entity
hbaseExecutor.put("account", toAnyPut(account));

// Get is supported by Model/entity
Account dbAccount = hbaseExecutor.get(Account.class, "account", AnyGet.valueOf(account.getId()));
N.println(dbAccount);

// Delete the inserted account
hbaseExecutor.delete("account", AnyDelete.valueOf(account.getId()));

HBase Java:

Account account = createAccount();

// Insert an account into HBase store
Put put = new Put(Bytes.toBytes(account.getId()));
put.addColumn(Bytes.toBytes("name"), Bytes.toBytes("firstName"), Bytes.toBytes(account.getName().firstName().value()));
put.addColumn(Bytes.toBytes("name"), Bytes.toBytes("lastName"), Bytes.toBytes(account.getName().lastName().value()));
put.addColumn(Bytes.toBytes("contact"), Bytes.toBytes("city"), Bytes.toBytes(account.getContact().city().value()));
put.addColumn(Bytes.toBytes("contact"), Bytes.toBytes("state"), Bytes.toBytes(account.getContact().state().value()));
put.addColumn(Bytes.toBytes("createTime"), Bytes.toBytes(""), Bytes.toBytes(N.stringOf(account.createTime().value())));

hbaseExecutor.put("account", put);

// Get the inserted account from HBase store
Result result = hbaseExecutor.get("account", new Get(Bytes.toBytes(account.getId())));
CellScanner cellScanner = result.cellScanner();
while (cellScanner.advance()) {
    final Cell cell = cellScanner.current();
    N.println(Bytes.toString(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()));
    N.println(Bytes.toString(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()));
    N.println(Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
    // ... a lot of work to do
}

// Delete the inserted account from HBase store.
hbaseExecutor.delete("account", new Delete(Bytes.toBytes(account.getId())));

(: HBaseExecutor)

+1

All Articles