适用于java的最佳HBase客户端API是什么
我正在做一个项目,在这个项目中我开始使用hbase。这个项目是基于java的。我需要知道什么是适用于java的最佳hbase客户端api。hbase在核心库中有自己的java客户端。它几乎涵盖了一切。(也得到了联系)。如果您需要一个异步客户机,您可以从stumbleupon进行检查,这是一个可靠的客户机。但它的过滤器支持是有限的(虽然它有基本的过滤器,但它们工作起来很有魅力)。如果您使用的是java,我不建议您使用via rest。Kundera是Hbase以及Cassandra和MongoDB的对象数据存储映射工具 其中一些突出特点是:适用于java的最佳HBase客户端API是什么,java,api,hadoop,hbase,Java,Api,Hadoop,Hbase,我正在做一个项目,在这个项目中我开始使用hbase。这个项目是基于java的。我需要知道什么是适用于java的最佳hbase客户端api。hbase在核心库中有自己的java客户端。它几乎涵盖了一切。(也得到了联系)。如果您需要一个异步客户机,您可以从stumbleupon进行检查,这是一个可靠的客户机。但它的过滤器支持是有限的(虽然它有基本的过滤器,但它们工作起来很有魅力)。如果您使用的是java,我不建议您使用via rest。Kundera是Hbase以及Cassandra和MongoDB
- JPA2.0兼容
- 使用lucene的列/列族索引
- 支持实体关系和JPA查询
- 跨数据存储持久性
playOrm是另一种java工具,您可以在其中注释实体并立即启动和运行。由于nosql与JPA太不一样,因此它并非有意兼容JPA。它有类似findAll()的方法,因为您希望在nosql中并行读取
playOrm确实添加了JQL,但对nosql有一个扭曲……作为扭曲的一个例子,您可以将万亿行划分为10亿个分区,并将JQL划分为任何分区,并与其他表连接。如果您来自JPA世界,那么向noSql的过渡就容易多了。Kundera是推荐使用的客户端。 作者正在为此而努力 ,HBase Java客户端的简单包装器。与本机HBase Java驱动程序相比,HBaseExecutor具有以下功能:
- 使用实体/字符串为操作(CRUD)提供一致/集成/简洁的API
- 字节参数/操作的包装,以提高可操作性
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的开发人员)我假设您正在询问是应该直接编写Java代码还是通过REST访问HBase。答案取决于应用程序的需要。我想问一下如何使用java连接到hbase。因此,它必须有一个api。我想下载,但uptill现在我无法这样做,所以HBase网站有下载和安装HBase的完整说明。从那里开始:我找到了。感谢您的帮助。您是否将列/列系列的lucene索引存储在hdfs上?