java 最好的 HBase 客户端 API 是什么

发布于 2024-12-09 17:13:50 字数 1539 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

别靠近我心 2024-12-16 17:13:50

HBase 在核心库中有自己的 java 客户端。它几乎涵盖了所有内容。 (也有连接)。如果您需要异步客户端,您可以从 stumbleupon 查看 asyncbase,这是一个可靠的客户端。但它的过滤器支持是有限的。(尽管它有基本的过滤器,而且它们的工作方式很神奇)。如果您使用java,我不建议使用via rest。

HBase has its own java client in core library. It covers pretty much everything. (Got connection as well). If you need a asynchronous client You can check asyncbase from stumbleupon, which is a solid client. But it's filter support is limited.(it has basic filters though, and they work like charm). If you are using java I wouldn't recommend using via rest.

凡间太子 2024-12-16 17:13:50

昆德拉是推荐客户使用的。
作者正在为此努力。

Kundera is a recommend client for use.
the author is work hard for it.

两个我 2024-12-16 17:13:50

Kundera 是 Hbase 以及 Cassandra 和 MongoDB 的对象数据存储映射工具。

一些显着的功能包括:

  • 符合 JPA 2.0。
  • 使用 lucene 的列/列族索引。
  • 支持实体关系和 JPA 查询。
  • 跨数据存储持久性

它托管在这里:
https://github.com/impetus-opensource/Kundera

Kundera is a object-datastore mapping tool for Hbase alongwith Cassandra and MongoDB.

Some of the salient features are:

  • JPA 2.0 compliant.
  • Column/ column family indexing using lucene.
  • Support for entity relationships and JPA queries.
  • Cross-datastore persistence

It's hosted here:
https://github.com/impetus-opensource/Kundera

﹎☆浅夏丿初晴 2024-12-16 17:13:50

playOrm 是另一个 java 工具,您可以在其中注释实体并立即启动并运行。它故意不符合 JPA,因为 nosql 太不同了。它有像 findAll() 这样的方法,因为你想在 nosql 中并行读取。

playOrm 确实添加了 JQL,但对 nosql 做了一些改动...作为改动的一个示例,您可以将一万亿行划分为 10 亿个分区,并对任何分区执行 JQL 并与其他表连接。如果您来自 JPA 领域,那么它会让您更轻松地过渡到 noSql。

playOrm is a another java tool where you can annotate your entities and immediately be up and running. It is NOT JPA compliant on purpose as nosql is too different. It has methods like findAll() as you want to parallel your reads in nosql.

playOrm does add JQL but with a twist for nosql....As an example of the twist, you can partition a trillion row into 1 billion partitions and do JQL into any partition and join with other tables. It makes a transition to noSql much easier if you come from the JPA world.

一枫情书 2024-12-16 17:13:50

HBaseExecutor,HBase Java 客户端的简单包装。与原生 HBase Java 驱动程序相比,HBaseExecutor 具有以下功能:

  • 为实体/字符串的操作(CRUD)提供一致/集成/简洁的 API。
  • 字节参数/操作的包装器以提高可操作性。

这是一个使用 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 的开发人员)

HBaseExecutor, a simple wrapper of HBase Java client. Comparing to the native HBase Java Driver, HBaseExecutor has below features:

  • Provides consistent/Integrated/Concise APIs for operations(CRUD) with entity/String.
  • Wrappers for the bytes parameters/operations to improve operability.

Here is a simple sample with 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()));

Comparing to the sample with HBase Java client:

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())));

(Declaration:I'm the developer of HBaseExecutor)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文