If you use the HBase API, you can use Realtime Compute for Apache Flink or Apache Flink to connect to an ApsaraDB for Lindorm (Lindorm) cluster. You can use Lindorm to create a dimension table or result table in Flink. A table in Flink can be used in the same way as that in HBase. For more information, see Create an ApsaraDB for HBase result table and Create an ApsaraDB for HBase dimension table in the Realtime Compute for Apache Flink documentation.

If you execute data definition language (DDL) statements to use Lindorm to create a dimension table or result table in Flink, specify the endpoint of a Lindorm cluster. Flink uses the HBase API for Java to connect to a Lindorm cluster. By default, the username and the password are root. If you use a newly created account, grant the account read and write permissions on the tables that are associated with Flink. For more information, see Manage ACLs. You can use the following sample DDL statements to create tables.

Create a dimension table

1. CREATE TABLE Lindorm (
2.   `key` varchar,
3.    `name` varchar,
4.    PRIMARY KEY (`key`), -- The rowkey of the table in Lindorm. 
5.    PERIOD FOR SYSTEM_TIME --The identifier of the dimension table. 
6.   ) with (
7.    TYPE = 'cloudLindorm',
8.    endpoint = 'host:port',-- The endpoint used by the Java API to connect to the Lindorm cluster.
9.    columnFamily = 'xxxxxx',
10.    userName  = 'root', -- The username.
11.    password = 'root', -- The password.
12.    tableName = 'xxxxxx'
13. );

Create a result table

1. create table liuxd_user_behavior_test_front (
2.    row_key varchar,
3.    from_topic varchar,
4.    origin_data varchar,
5.    record_create_time varchar,
6.    primary key (row_key)) 
7. with (
8.    type = 'cloudLindorm',
9.    endpoint = 'host:port', -- The endpoint used by the Java API to connect to the Lindorm cluster.
10.    userName  = 'root', -- The username.
11.    password = 'root', -- The password.
12.    columnFamily = '<yourColumnFamily>',
13.    tableName = '<yourTableName>',
14.    batchSize = '500'
15. )

Network connection

If you use a Flink cluster in shared mode, connect to a Lindorm cluster over a virtual private cloud (VPC). For more information about how to enable internal access, see Authorize Realtime Compute for Apache Flink to access a VPC. If you use a Flink cluster in exclusive mode, the Flink cluster and the Lindorm cluster must be deployed in the same VPC. Otherwise, you can connect to the Lindorm cluster only over the Internet. Before you connect to the Lindorm cluster over a VPC or the Internet, add the IP address of the Flink cluster to the whitelist of the Lindorm cluster. For more information, see Configure a whitelist.