---
title: "HBaseAPI 方案介绍 - OceanBase 数据库 V4.1.0 | OceanBase 文档中心"
description: HBaseAPI 方案介绍 HBaseAPI 通过 HBase 兼容的 API 和合适的存储模型，使 HBase 业务可以平滑迁移到 OceanBase 数据库。 背景信息 OceanBase 的 HBaseAPI 客户端基于 TableAPI 提供的基本接口，在客户端封装了 HBase 兼容的 API 接口（目前已…
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*P8CuR4UJ_FkAAAAAAAAAAAAADiGDAQ/original) OceanBase 数据库分布式版 - V 4.1.0

# HBaseAPI 方案介绍

更新时间：2023-09-06 15:10:39

[编辑](https://github.com/oceanbase/oceanbase-doc/edit/V4.1.0/zh-CN/700.reference/400.development-reference/600.hbaseapi/100.introduction-to-hbaseapi-scheme.md)  

HBaseAPI 通过 HBase 兼容的 API 和合适的存储模型，使 HBase 业务可以平滑迁移到 OceanBase 数据库。

## 背景信息

OceanBase 的 HBaseAPI 客户端基于 TableAPI 提供的基本接口，在客户端封装了 HBase 兼容的 API 接口（目前已兼容 HBase 0.94 版本的特性）。若您当前有业务使用了原生 HBase 数据操作逻辑，您可以通过安装 OceanBase 数据库集群，在 OBServer 服务端建立 HBase Table，并通过 HBaseAPI 进行数据操作。

> **说明**
>
>  
>
> 关于 TableAPI 的方案介绍，用户可参考 [TableAPI 方案介绍](https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001697318)。

欢迎您访问 [OceanBase GitHub 网站](https://github.com/oceanbase) 体验 OBKV 的客户端使用：

- TableAPI 使用请参考：[Simple TableAPI Demo](https://github.com/oceanbase/obkv-table-client-java/tree/master/example)

如果您想对 HBase 有更深入的了解，请参考 [Apache HBase 官方网站](https://hbase.apache.org/)、[Apache HBase interface 接口](https://hbase.apache.org/1.1/apidocs/org/apache/hadoop/hbase/client/Table.html)。

## HBaseAPI 存储模型

您可以使用宽表模型（WideColumn）对数据建模，以便更好的兼容 HBase 的数据及后续通过 HBaseAPI 维护。具体操作，请参考 [HBaseAPI 存储模型](https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001700460)。 如果您想了解 HBase 存储模型的详细内容，请参考 [Apache HBase 数据模型](https://hbase.apache.org/book.html#datamodel)。

## HBaseAPI 客户端

您可以通过 HBaseAPI 客户端，使用 HBase 兼容的 API 进行数据处理，具体操作，请参考 [HBaseAPI 客户端使用介绍](https://www.oceanbase.com/docs/common-oceanbase-database-cn-10000000001700461)。

以下是 HBaseAPI 的相关功能说明：

### 客户端线程池模型

HBaseAPI 提供 table pool 池化模式管理多个 table 的操作实例，目前资源池包含有 Reusable、RoundRobin 和 ThreadLoca 三种方式。用户可以在实例化 table pool 时指定使用某种模式。

### 路由表预热

支持在集群某台机器宕机时，客户端对指定 HBase table 的路由表信息进行刷新，避免造成服务暂停或服务无法访问。客户端也可以通过不定时预热操作，刷新集群的路由信息。

### 兼容性

HBaseAPI 客户端实现了 [HTableInterface](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html) 的接口，其接口的兼容性如下：

| Modifier and Type | Method and Description | compatibility |
| --- | --- | --- |
| [Result](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Result.html) | [append](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#append(org.apache.hadoop.hbase.client.Append))([Append](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Append.html) append）   Appends values to one or more columns within a single row. | supported |
| [Object](https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true)[] | [batch](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#batch(java.util.List)) ([List](https://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true) <? extends [Row](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Row.html) > actions)Same as [batch(List, Object[])](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#batch(java.util.List,%20java.lang.Object[])),    but returns an array of results instead of using a results parameter reference. | not support |
| void | [batch](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#batch(java.util.List,%20java.lang.Object[]))([List](https://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true) <? extends [Row](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Row.html) > actions, [Object](https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true)[] results)   Method that does a batch call on Deletes, Gets, Puts, Increments, Appends and RowMutations. | not support |
| boolean | [checkAndDelete](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#checkAndDelete(byte[],%20byte[],%20byte[],%20byte[],%20org.apache.hadoop.hbase.client.Delete))(byte[] row, byte[] family, byte[] qualifier, byte[] value,[Delete](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Delete.html) delete)   Atomically checks if a row/family/qualifier value matches the expected value. | supported |
| boolean | [checkAndPut](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#checkAndPut(byte[],%20byte[],%20byte[],%20byte[],%20org.apache.hadoop.hbase.client.Put))(byte[] row, byte[] family, byte[] qualifier, byte[] value, [Put](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Put.html) put)   Atomically checks if a row/family/qualifier value matches the expected value. | supported |
| void | [close](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#close())()   Releases any resources help or pending changes in internal buffers. | supported |
| <T extends [CoprocessorProtocol](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/ipc/CoprocessorProtocol.html),R>[Map](https://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true)<byte[],R> | [coprocessorExec](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#coprocessorExec(java.lang.Class,%20byte[],%20byte[],%20org.apache.hadoop.hbase.client.coprocessor.Batch.Call))([Class](https://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true)<T> protocol, byte[] startKey, byte[] endKey, [Batch.Call](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/coprocessor/Batch.Call.html)<T,R> callable)   Invoke the passed [Batch.Call](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/coprocessor/Batch.Call.html) against the [CoprocessorProtocol](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/ipc/CoprocessorProtocol.html) instances running in the selected regions. | not support |
| <T extends [CoprocessorProtocol](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/ipc/CoprocessorProtocol.html),R> void | [coprocessorExec](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#coprocessorExec(java.lang.Class,%20byte[],%20byte[],%20org.apache.hadoop.hbase.client.coprocessor.Batch.Call,%20org.apache.hadoop.hbase.client.coprocessor.Batch.Callback))([Class](https://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true)<T> protocol, byte[] startKey, byte[] endKey,[Batch.Call](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/coprocessor/Batch.Call.html)<T,R> callable,[Batch.Callback](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/coprocessor/Batch.Callback.html)<R> callback)   Invoke the passed [Batch.Call](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/coprocessor/Batch.Call.html) against the [CoprocessorProtocol](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/ipc/CoprocessorProtocol.html) instances running in the selected regions. | not support |
| <T extends [CoprocessorProtocol](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/ipc/CoprocessorProtocol.html)> T | [coprocessorProxy](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#coprocessorProxy(java.lang.Class,%20byte[]))([Class](https://docs.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true)<T> protocol, byte[] row)   Creates and returns a proxy to the CoprocessorProtocol instance running in the region containing the specified row. | not support |
| void | [delete](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#delete(org.apache.hadoop.hbase.client.Delete))([Delete](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Delete.html) delete)   Deletes the specified cells/row. | supported |
| void | [delete](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#delete(java.util.List))([List](https://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true)<[Delete](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Delete.html)> deletes)   Deletes the specified cells/rows in bulk. | supported |
| boolean | [exists](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#exists(org.apache.hadoop.hbase.client.Get))([Get](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Get.html) get)   Test for the existence of columns in the table, as specified in the Get. | supported |
| void | [flushCommits](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#flushCommits())()   Executes all the buffered [Put](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Put.html) operations. | supported |
| [Result](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Result.html) | [get](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#get(org.apache.hadoop.hbase.client.Get))([Get](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Get.html) get)   Extracts certain cells from a given row. | supported |
| [Result](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Result.html)[] | [get](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#get(java.util.List))([List](https://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true)<[Get](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Get.html)> gets)   Extracts certain cells from the given rows, in batch. | supported |
| org.apache.hadoop.conf.Configuration | [getConfiguration](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getConfiguration())()   Returns the Returns the Configuration object used by this instance. | supported |
| [Result](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Result.html) | [getRowOrBefore](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getRowOrBefore(byte[],%20byte[]))(byte[] row, byte[] family)   Deprecated. As of version 0.92 this method is deprecated without replacement. getRowOrBefore is used internally to find entries in .META. and makes various assumptions about the table (which are true for .META. but not in general) to be efficient. | Deprecated |
| [ResultScanner](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/ResultScanner.html) | [getScanner](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getScanner(byte[]))(byte[] family)   Gets a scanner on the current table for the given family. | supported |
| [ResultScanner](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/ResultScanner.html) | [getScanner](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getScanner(byte[],%20byte[]))(byte[] family, byte[] qualifier)   Gets a scanner on the current table for the given family and qualifier. | supported |
| [ResultScanner](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/ResultScanner.html) | [getScanner](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getScanner(org.apache.hadoop.hbase.client.Scan))([Scan](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Scan.html) scan)   Returns a scanner on the current table as specified by the [Scan](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Scan.html) object. | supported |
| [HTableDescriptor](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/HTableDescriptor.html) | [getTableDescriptor](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getTableDescriptor())()   Gets the [table descriptor](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/HTableDescriptor.html) for this table. | not support |
| byte[] | [getTableName](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getTableName())()   Gets the name of this table. | supported |
| long | [getWriteBufferSize](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#getWriteBufferSize())()   Returns the maximum size in bytes of the write buffer for this HTable. | supported |
| [Result](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Result.html) | [increment](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#increment(org.apache.hadoop.hbase.client.Increment))([Increment](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Increment.html) increment)   Increments one or more columns within a single row. | supported |
| long | [incrementColumnValue](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#incrementColumnValue(byte[],%20byte[],%20byte[],%20long))(byte[] row, byte[] family, byte[] qualifier, long amount)   Atomically increments a column value. | supported |
| long | [incrementColumnValue](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#incrementColumnValue(byte[],%20byte[],%20byte[],%20long,%20boolean))(byte[] row, byte[] family, byte[] qualifier, long amount, Durability durability)   Atomically increments a column value. | supported |
| boolean | [isAutoFlush](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#isAutoFlush())()   Tells whether or not 'auto-flush' is turned on. | supported |
| [RowLock](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/RowLock.html) | [lockRow](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#lockRow(byte[]))(byte[] row)   Deprecated.[RowLock](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/RowLock.html) and associated operations are deprecated | Deprecated |
| void | [mutateRow](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#mutateRow(org.apache.hadoop.hbase.client.RowMutations))([RowMutations](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/RowMutations.html) rm)   Performs multiple mutations atomically on a single row. | not support |
| void | [put](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#put(java.util.List))([List](https://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true)<[Put](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Put.html)> puts)   Puts some data in the table, in batch. | supported |
| void | [put](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#put(org.apache.hadoop.hbase.client.Put))([Put](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/Put.html) put)   Puts some data in the table. | supported |
| void | [setAutoFlush](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#setAutoFlush(boolean))(boolean autoFlush)   See [setAutoFlush(boolean, boolean)](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#setAutoFlush(boolean,%20boolean)) | supported |
| void | [setAutoFlush](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#setAutoFlush(boolean,%20boolean))(boolean autoFlush, boolean clearBufferOnFail)   Turns 'auto-flush' on or off. | supported |
| void | [setWriteBufferSize](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#setWriteBufferSize(long))(long writeBufferSize)   Sets the size of the buffer in bytes. | supported |
| void | [unlockRow](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#unlockRow(org.apache.hadoop.hbase.client.RowLock))([RowLock](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/RowLock.html) rl)   Deprecated.[RowLock](https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk/0.94/apidocs/org/apache/hadoop/hbase/client/RowLock.html) and associated operations are deprecated | Deprecated |

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
