Creating and Using an HBase Cluster for Offline Query
Scenario
This topic helps you create an HBase query cluster from scratch and describes how to create and query HBase tables through the cluster client.
An HBase cluster uses Hadoop and HBase components to provide a column-oriented distributed cloud storage system featuring enhanced reliability, great performance, and elastic scalability. It applies to the storage and distributed computing of massive amounts of data. You can use HBase to build a storage system capable of storing TB- or even PB-level data. With HBase, you can filter and analyze data with ease and get responses in milliseconds, rapidly mining data value.
Procedure
Before you start, complete operations described in Preparations. Then, follow these steps:
- Creating an MRS Cluster: Create an HBase query cluster of MRS 3.2.0-LTS.1.
- Installing the Cluster Client: Download and install the MRS cluster client.
- Creating a Table Using the HBase Client: Create a table, insert table data, query the data, and delete the table on the HBase client.
- Releasing resources: To avoid additional expenditures, release resources promptly if you no longer need them.
Preparations
- You have prepared an IAM user who has the permission to create MRS clusters. For details, see Creating an MRS User.
Video Tutorial
This video uses an MRS 3.1.0 cluster (with Kerberos authentication disabled) as an example to describe how to use an HBase client to create a table, insert data into the table, and modify table data. For details about how to use an HBase client to create a table, see Using an HBase Client.

The UI may vary depending on the version. The video tutorial is for reference only.
Step 1: Creating an MRS Cluster
- Go to the Buy Cluster page.
- Search for MapReduce Service in the service list and enter the MRS console.
- Click Buy Cluster. The Quick Config tab is displayed.
- Configure the cluster as you need. In this example, a pay-per-use MRS 3.2.0-LTS.1 cluster will be created. For more details about how to configure the parameters, see Quickly Creating a Cluster.
Table 1 MRS cluster parameters Parameter
Example Value
Description
Billing Mode
Pay-per-use
Billing mode of the cluster you want to create. MRS provides two billing modes: yearly/monthly and pay-per-use.
Pay-per-use is a postpaid billing mode. You pay as you go and pay for what you use. The cluster usage is calculated by the second but billed every hour.
Region
CN-Hong Kong
Region where the MRS resources to be requested belong.
MRS clusters in different regions cannot communicate with each other over an intranet. For lower network latency and quick resource access, select the nearest region.
Cluster Name
mrs_demo
Name of the MRS cluster you want to create.
Cluster Type
Custom
A range of clusters that accommodate diverse big data demands. You can select a Custom cluster to run a wide range of analytics components supported by MRS.
Version Type
LTS
Version of the MRS cluster. Supported open-source components and their functions vary depending on the cluster version.
Cluster Version
MRS 3.2.0-LTS.1
Version of the MRS cluster. Supported open-source components and their functions vary depending on the cluster version. You are advised to select the latest version.
Component
HBase Query Cluster
Cluster templates containing preset opensource components you will need for your business.
AZ
AZ 1
Available AZ associated with the cluster region.
VPC
vpc-default
VPC where you want to create the cluster. You can click View VPC to view the name and ID. If no VPC is available, create one.
Subnet
subnet-default
Subnet where your cluster belongs. You can access the VPC management console to view the names and IDs of existing subnets in the VPC. If no subnet is created under the VPC, click Create Subnet to create one.
Cluster Node
Default value
Cluster node details.
Kerberos Authentication
Disabled
Whether Kerberos authentication is enabled.
Username
admin/root
Username for logging in to the cluster management page and the ECS node.
Password
-
User password for logging in to the cluster management page and the ECS node.
Confirm Password
-
Enter the user password again.
Enterprise Project
default
Enterprise project to which the cluster belongs.
Secure Communications
Selected
Select the check box to agree to use the access control rules.
Figure 1 Purchasing an HBase query cluster - Click Buy Now. A page is displayed showing that the task has been submitted.
- Click Back to Cluster List. You can view the status of the newly created cluster on the Active Clusters page.
Wait for the cluster creation to complete. The initial status of the cluster is Starting. After the cluster is created, the cluster status becomes Running.
Step 2: Installing the Cluster Client
You need to install a cluster client to connect to component services in the cluster and submit jobs.
You can install the client on a node in or outside the cluster. This topic installs the client on the Master1 node as an example.
- Click the MRS cluster name in the cluster list to go to the dashboard page.
- Click Access Manager next to MRS Manager. In the displayed dialog box, select EIP and configure the EIP information.
For the first access, click Manage EIPs to purchase an EIP on the EIP console. Go back to the Access MRS Manager dialog box, refresh the EIP list, and select the EIP.
- Select the confirmation check box and click OK to log in to the FusionInsight Manager of the cluster.
The username for logging in to FusionInsight Manager is admin, and the password is the one configured during cluster purchase.
- On the displayed Homepage page, click
next to the cluster name and click Download Client to download the cluster client.
Figure 2 Downloading the clientIn the Download Cluster Client dialog box, set the following parameters:
- Set Select Client Type to Complete Client.
- Retain the default value for Platform Type, for example, x86_64.
- Retain the default path for Save to Path. The generated file will be saved in the /tmp/FusionInsight-Client directory on the active OMS node of the cluster.
Figure 3 Downloading the cluster clientClick OK and wait until the client software is generated.
- Go back to the MRS console and click the cluster name in the cluster list. Go to the Nodes tab, click the name of the node that contains master1. In the upper right corner of the ECS details page, click Remote Login to log in to the Master1 node.
Figure 4 Checking the Master1 node
- Log in to the Master1 node as user root. The password is the one you set for the root user during cluster purchase.
- Switch to the directory where the client software package is stored and decompress the package.
cd /tmp/FusionInsight-Client/
tar -xvf FusionInsight_Cluster_1_Services_Client.tar
tar -xvf FusionInsight_Cluster_1_Services_ClientConfig.tar
- Go to the directory where the installation package is stored and install the client.
cd FusionInsight_Cluster_1_Services_ClientConfig
Install the client to a specified directory (an absolute path), for example, /opt/client.
./install.sh /opt/client
... ... component client is installed successfully ...
A client installation directory will be automatically created if it does not exist. If there is such directory, it must be empty. The directory name cannot contain spaces. The client installation directory can contain only uppercase letters, lowercase letters, digits, and underscores (_).
Step 3: Creating a Table Using the HBase Client
- Log in to the node (Master1) where the MRS client is deployed as user root.
- Switch to the client installation directory and configure environment variables.
cd /opt/client
source bigdata_env
- Access the HBase shell CLI.
hbase shell
- Create the user_info table on the HBase client.
- Create the user_info table.
create 'user_info',{NAME => 'i'}
- Add data to the user_info table.
put 'user_info','12005000201','i:name','A' put 'user_info','12005000201','i:gender','Male' put 'user_info','12005000201','i:age','19' put 'user_info','12005000201','i:address','City A' put 'user_info','12005000201','i:degree','master' put 'user_info','12005000201','i:pose','manager'
- Create the user_info table.
- Query the HBase table.
- Query usernames and addresses by user ID.
scan 'user_info',{STARTROW=>'12005000201',STOPROW=>'12005000201',COLUMNS=>['i:name','i:address']}
The query result is as follows:
ROW COLUMN+CELL 12005000201 column=i:address, timestamp=2021-10-30T10:21:42.196, value=City A 12005000201 column=i:name, timestamp=2021-10-30T10:21:18.594, value=A 1 row(s) Took 0.0996 seconds
- Query information by username.
scan 'user_info',{FILTER=>"SingleColumnValueFilter('i','name',=,'binary:A')"}
The query result is as follows:
ROW COLUMN+CELL 12005000201 column=i:address, timestamp=2021-10-30T10:21:42.196, value=City A 12005000201 column=i:age, timestamp=2021-10-30T10:21:30.777, value=19 12005000201 column=i:degree, timestamp=2021-10-30T10:21:53.284, value=master 12005000201 column=i:gender, timestamp=2021-10-30T10:21:18.711, value=Male 12005000201 column=i:name, timestamp=2021-10-30T10:21:18.594, value=A 12005000201 column=i:pose, timestamp=2021-10-30T10:22:07.152, value=manager 1 row(s) Took 0.2158 seconds
- Query usernames and addresses by user ID.
- Delete the HBase table.
- Delete user data from the user information table.
delete 'user_info','12005000201','i'
- Delete the user information table.
disable 'user_info' drop 'user_info'
- Delete user data from the user information table.
Follow-up Operations: Releasing Resources
To avoid additional expenditures, release resources promptly if you no longer need them. For details, see Deleting an MRS Cluster.
Related Information
For details about HBase permission management, indexes and global secondary indexes, and HBase data migration using BulkLoad, see Using HBase.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot