天天看點

How to Use HBase Client to Access Alibaba Cloud NoSQL Table Store

How to Use HBase Client to Access Alibaba Cloud NoSQL Table Store

The Alibaba Cloud NoSQL Table Store is a scalable and fully managed NoSQL database service, based on automatic data partitioning and load balancing technologies. Built on SSD technology, this cloud NoSQL database service enables you to store large quantities of structured and semi-structured data with real-time access. Furthermore, it facilitates strong consistency and single-digit millisecond latency.

Using HBase Client to Access Alibaba Cloud NoSQL Table Store has the following advantages:

● Authenticates each request to prevent unauthorized data access to NoSQL servers.

● Easily scales reserved resources based on real-time application hosting needs.

● Provides seamless scaling of applications hosted on the cloud.

● Automated failure detection and quick failure recovery.

We will go into the details of how you can use HBase client to access Alibaba Cloud Table Store. However, we will start by briefly introducing related terms such as Apache HBase, Table Store, and HBase Client. This information will help you understand the steps in a more effective manner.

Apache HBase is a Hadoop database that belongs to the Hadoop ecosystem. Since the release of Google’s publications on ‘The Google File System, MapReduce: Simplified Data Processing on Large Clusters and Bigtable: A Distributed Storage System for Structured Data', four years ago, the open source circle has been taking these as inspiration to design the three open-source systems. The best one being the Hadoop ecology, which corresponds to Hadoop, HDFS and HBase respectively. The current Hadoop ecology is a benchmark in the industry owing to its large-scale application and honing for more than a decade. So established is the current Hadoop ecology that it is "forcing" NoSQL's originator Google Bigtable to support HBase wrapper and provide the Bigtable HBase client.

Unlike HBase which uses Java, Table Store is a NoSQL database independently developed by Alibaba Cloud. It uses C++ for development, just like Bigtable.

Since Table Store is a NoSQL database similar to HBase, it plays a significant role in its functioning. In most scenarios, Table Store may even outperform HBase. However, Table Store has certain advanced features not available in HBase.

HBase client, provided by HBase is for users to access HBase conveniently. It supports reading, writing, scanning, batch operation, table management as well as other features.

Now that we have explained the related elements, let us move forward towards understanding the various aspects of using HBase client to access Alibaba Cloud NoSQL Table Store.

Since a long time, Hadoop Ecology has been a widely applied solution amongst various organizations as the only open-source big data solution. At present, most companies with self-built data processing systems use Hadoop ecosystems, such as HBase. Earlier, when migrating data to Alibaba Cloud's NoSQL Table Store, the users required to rewrite the client code to use Table Store. Though this approach results in higher performance and is user-friendly, it is highly time-consuming in the early stages. Table Store introduced the Table Store HBase client last year to address this problem.

If you were previously using HBase Client to access HBase, you only require changing the dependency on HBase Client to Table Store HBase client in the project now. Furthermore, you also need to modify the hbase.client.connection.impl value in the hbase-site.xml to com.alicloud.tablestore.hbase.TablestoreConnection without any other changes to the code. Let us look at an example and the steps for effective usage of HBase client. This would make understanding the concept much easier.

The first step in this would be to configure project dependencies.

You can configure the Maven dependency as follows:

Then you would need to add the following configuration items in hbase-site.xml:

Next, connect to Table Store service by creating a Table Store connection object by executing the following code:

Once you have connected to a Table Store service, specify the table name to create a table. For this, use default values for MaxVersion and TimeToLive.

You would now need to write a row of data to Table Store. The steps of writing data are:

Further, you need to read data in a specified row by running the code below.

Then, read data by range by executing the following:

Next, use Admin API to delete a table.

At present, some users use Table Store. Constant optimization takes place for Table Store HBase client based on user feedback with an aim to elevate its performance close to the level of the native Table Store.

繼續閱讀