OceanBase
English日本語简体中文
ドキュメントホーム
製品
エコシステム
リリース

データベース

OceanBase CloudOceanBaseデータベース

データベース

OceanBase CloudOceanBaseデータベース
OceanBase CloudOceanBaseデータベース

OceanBaseデータベース

KV - V4.4.2
  • OBKVの概要
  • OBKVのアーキテクチャ
  • OBKV-Table
    • OBKV-Table概要
      • OBKV-Tableの概要
      • OBKV-Tableのコア機能
      • OBKV-Tableデプロイの概要
    • シンプルなKey-Valueストレージのクイックスタート(Java)
    • OBKV-Table Javaクライアントを使ったアプリケーション開発
      • OBKV-Table Java開発ガイド
      • OBKV-Table開発の準備
      • OBKV-Table Javaクライアントを使用してクラスタに接続する
      • OBKV-Table操作例
        • OBKV-Tableへのデータ書き込み
        • OBKV-Tableによるデータのクエリ
        • OBKV-Tableでのデータ更新
        • OBKV-Tableによるデータの削除
      • OBKV-Table Javaクライアントのパラメータ設定
    • OBKV-Table管理
      • OBKV-Table管理の概要
      • OBKV-Tableの高可用性
      • OBKV-Tableのセキュリティ権限
      • OBKV-Tableモニタリングメトリクス
    • OBKV-Tableリファレンス
      • OBKV-Tableのデータモデル
      • OBKV-Tableの操作タイプ
      • OBKV-Tableがサポートするデータ型
      • OBKV-Table全文インデックス
      • OBKV-Tableのグローバルインデックスの使用範囲と例
      • OBKV-Tableの期限切れデータ削除
      • OBKV-Tableのグループコミット
      • OBKV-Tableの弱い整合性読み取りと最寄りデータセンターからの読み取り
      • OBKV-Table関連ビュー
    • OBKV-Table よくある質問
  • OBKV-HBase
    • OBKV-HBaseの概要
    • OBKV-HBaseのコア機能
    • OBKV-HBaseのデプロイ
    • OBKV-HBaseによるアプリケーション開発
      • OBKV-HBase アプリケーション開発の概要
      • OBKV-HBase Javaクライアントを使用したクラスタへの接続
      • HBaseの業務コードをOBKV-HBaseに移行する
      • OBKV-HBase データ操作の例
    • OBKV-HBase 移行ガイド
    • OBKV-HBase管理
      • OBKV-HBase管理の概要
      • OBKV-HBaseの高可用性
      • OBKV-HBaseのセキュリティ権限
      • OBKV-HBaseモニタリングメトリクス
    • OBKV-HBaseクエリの最適化
    • OBKV-HBaseの性能テスト
    • OBKV-HBaseリファレンス
      • OBKV-HBaseデータモデル
      • OBKV-HBaseのデータスキーマ
      • HBaseとの互換インターフェース
      • HBaseと互換性のあるフィルター
      • OBKV-HBaseの自動パーティション分割
      • OBKV-HBaseにおける期限切れデータの削除
      • OBKV-HBaseの弱い整合性読み取りと最寄りデータセンターからの読み取り
      • OBKV-HBase関連ビュー
    • OBKV-HBaseエコシステム統合
      • Flink連携
        • Flinkコネクタを使用してOBKV-HBaseにデータを同期する
        • ネイティブFlinkによるOBKV-HBaseへのアクセス
      • HiveによるOBKV-HBaseへのアクセス
      • SparkによるOBKV-HBaseへのアクセス
  • OBKVリリースノート
    • OBKV Enterprise版

PDF をダウンロード

このページには現在中国語/日本語版がなく、英語版を表示しています。
ドキュメントフィードバック
  1. ドキュメントセンター
  2. OceanBaseデータベース
  3. KV
  4. V4.4.2

Synchronize data to OBKV-HBase by using Flink

最終更新:2026-09-04 10:25:15

Get started
Download the SQL JAR package
Examples
Example for a Java application
Example for the Flink SQL client
Parameters
References

With Flink Connector provided by OBKV-HBase, you can write data to OBKV-HBase by using the OBKV-HBase Java client obkv-hbase-client-java in Flink.

Get started

You can obtain an official release of Flink Connector from the release page or Maven central repository.

<dependency>
    <groupId>com.oceanbase</groupId>
    <artifactId>flink-connector-obkv-hbase</artifactId>
    <version>${project.version}</version>
</dependency>

You can obtain the latest snapshot release of Flink Connector by configuring the Maven snapshot repository.

<dependency>
    <groupId>com.oceanbase</groupId>
    <artifactId>flink-connector-obkv-hbase</artifactId>
    <version>${project.version}</version>
</dependency>

<repositories>
    <repository>
        <id>sonatype-snapshots</id>
        <name>Sonatype Snapshot Repository</name>
        <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

You can also download and compile the source code of Flink Connector to obtain its package.

git clone https://github.com/oceanbase/flink-connector-oceanbase.git
cd flink-connector-oceanbase
mvn clean package -DskipTests

Download the SQL JAR package

To use Flink Connector in the Flink SQL client, you need to download the flink-sql-connector-obkv-hbase-${project.version}.jar package that contains all dependencies.

  • Official release

  • Snapshot release

Examples

Create a table named htable1$family1 in OceanBase Database. In the table name, htable is the table name in HBase, and family1 is the column family in HBase.

use test;
CREATE TABLE `htable1$family1`
(
  `K` varbinary(1024)    NOT NULL,
  `Q` varbinary(256)     NOT NULL,
  `T` bigint(20)         NOT NULL,
  `V` varbinary(1048576) NOT NULL,
  PRIMARY KEY (`K`, `Q`, `T`)
)

Example for a Java application

Take a Maven project as an example. Add the required dependencies to the pom.xml file and run the following code:

package com.oceanbase;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

public class Main {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env =
                StreamExecutionEnvironment.getExecutionEnvironment().setParallelism(1);
        StreamTableEnvironment tEnv =
                StreamTableEnvironment.create(
                        env, EnvironmentSettings.newInstance().inStreamingMode().build());

        tEnv.executeSql(
                "CREATE TABLE t_sink ( "
                        + " rowkey STRING,"
                        + " family1 ROW<column1 STRING, column2 STRING>,"
                        + " PRIMARY KEY (rowkey) NOT ENFORCED"
                        + ") with ("
                        + "  'connector'='obkv-hbase',"
                        + "  'url'='http://127.0.0.1:8080/services?...',"
                        + "  'schema-name'='test',"
                        + "  'table-name'='htable1',"
                        + "  'username'='root@test',"
                        + "  'password'='',"
                        + "  'sys.username'='root',"
                        + "  'sys.password'=''"
                        + ");");

        tEnv.executeSql(
                        "INSERT INTO t_sink VALUES "
                                + "('1', ROW('r1f1c1', 'r1f1c2')),"
                                + "('2', ROW('r2f1c1', 'r2f1c2')),"
                                + "('2', ROW('r3f1c1', 'r3f1c2'));")
                .await();
    }
}

After the code is executed, you can query the data in OceanBase Database.

For more information, see OBKVHBaseConnectorITCase.java.

Example for the Flink SQL client

Place the JAR files of required dependencies in the lib directory of Flink, and then create the target table in Flink by using the SQL client.

CREATE TABLE t_sink
(
  rowkey STRING,
  family1 ROW <column1 STRING,
  column2 STRING >,
  PRIMARY KEY (rowkey) NOT ENFORCED
) with (
  'connector'='obkv-hbase',
  'url'='http://127.0.0.1:8080/services?...',
  'schema-name'='test',
  'table-name'='htable1',
  'username'='root@test',
  'password'='',
  'sys.username'='root',
  'sys.password'='');

Insert the test data.

INSERT INTO t_sink
VALUES ('1', ROW ('r1f1c1', 'r1f1c2')),
       ('2', ROW ('r2f1c1', 'r2f1c2')),
       ('2', ROW ('r3f1c1', 'r3f1c2'));

After the insertion, you can query the data in OceanBase Database.

Parameters

Parameter
Required
Default value
Type
Description
url Yes String The ConfigUrl of the cluster. You can execute the SHOW PARAMETERS LIKE 'obconfig_url' statement to query the ConfigUrl.
schema-name Yes String The name of the OceanBase database.
table-name Yes String The table name in HBase. In OceanBase Database, the table name is in the hbase_table_name$family_name format.
username Yes String The username of a user in a user tenant.
password Yes String The password of a user in a user tenant.
sys.username Yes String The username of a user in the sys tenant.
sys.password Yes String The password of a user in the sys tenant.
hbase.properties No String The properties of 'obkv-hbase-client-java', which are separated with semicolons (;).
sync-write No false Boolean Specifies whether to enable synchronous write. When the value is true, data is directly written to the database without using the buffer.
buffer-flush.interval No 1s Duration The buffer refresh interval. When the value is 0, the buffer is not periodically refreshed.
buffer-flush.buffer-size No 1000 Integer The buffer size.
max-retries No 3 Integer The number of retries when a failure occurs.

References

  • Introduce decomposed Sink V2 interfaces
  • flink-connector-hbase
  • obkv-hbase-client-java

次のトピック

OBKVの概要
次へ
このページの内容
Get started
Download the SQL JAR package
Examples
Example for a Java application
Example for the Flink SQL client
Parameters
References