This topic describes how to connect to and use LindormTable.
Prerequisites
The version of LindormTable is 2.4.3 or later.
NoteFor more information, see Release notes of LindormTable and Upgrade the minor engine version of a Lindorm instance.
The IP address of your client is added to the Lindorm whitelist.
The HBase Java API VPC endpoint of LindormTable is obtained.
Usage notes
To connect to a Lindorm instance over the Internet or the Lindorm instance that you want to access is a single-node Lindorm instance, you must upgrade your SDK and change the configurations before you perform the operations described in this topic. For more information, see Step 1 in Use the ApsaraDB for HBase API for Java to connect to and use LindormTable.
If your application is deployed on an Elastic Compute Service (ECS) instance, make sure that your Lindorm instance and the ECS instance meet the following requirements to ensure network connectivity.
Your Lindorm instance and ECS instance are deployed in the same region. We recommend that you deploy the two instances in the same zone to reduce network latency.
Your Lindorm instance and ECS instance are deployed in the same VPC.
Configure connection parameters in Hive
Method 1: Add connection configurations to the hive-site.xml file.
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<!--
The LindormTable endpoint of the HBase Java API for Java
-->
<value>ld-bp1461s38p7y9****-proxy-lindorm.lindorm.rds.aliyuncs.com:30020</value>
</property>
</configuration>Method 2: Run a command in the Hive client.
// Specify the LindormTable endpoint of the HBase API for Java.
set hbase.zookeeper.quorum=ld-bp1461s38p7y9****-proxy-lindorm.lindorm.rds.aliyuncs.com:30020Procedure
Configure the LindormTable endpoint of the Lindorm instance to which you want to connect in the Hive client.
hive // Specify the LindormTable endpoint of the HBase API for Java. set hbase.zookeeper.quorum=ld-bp1461s38p7y9****-proxy-lindorm.lindorm.rds.aliyuncs.com:30020Create a table named hive_hbase_table in the Lindorm instance.
CREATE 'hive_hbase_table','cf1'Create an external table in Hive.
CREATE EXTERNAL TABLE hive_hbase_table(key int, value string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val") TBLPROPERTIES ("hbase.table.name" = "hive_hbase_table", "hbase.mapred.output.outputtable" = "hive_hbase_table");If OK is contained in the returned information, the external table is created.
Insert data into the external table and verify the insertion.
Insert data in the external table in Hive and verify the data is inserted in Lindorm.
Insert data into the external table:
insert into hive_hbase_table values(212,'bab');In Lindorm, verify the data is inserted into the external table:
scan 'hive_hbase_table'Output:
ROW COLUMN+CELL 212 column=cf1:val, timestamp=2023-03-13T15:35:10.270, value=babInsert data into the hive_hbase_table table in Lindorm and verify the data is inserted in Hive.
Insert data into the hive_hbase_table table:
put 'hive_hbase_table','213','cf1:val','dadsadasda'In Hive, verify the data is inserted into the hive_hbase_table table:
SELECT * FROM hive_hbase_table;Return values:
212 bab 213 dadsadasda
You cannot use Hive to directly read files in Lindorm. However, you can create or associate a Hive external table to read data from or write data to Lindorm.