Running a Cross-Cluster HBase BulkLoad Job
Scenario
BulkLoad operations consume a significant amount of compute resources and expend considerable amounts of network and disk I/O. To prevent impact on HBase read and write, you can run the BulkLoad job in another MRS cluster, and then copy and import the generated HFile into the tables of the HBase cluster.
Notes and Constraints
This section applies only to MRS 3.6.0-LTS and later.
Prerequisites
- For a security cluster, mutual trust and cross-cluster replication have been configured between the two clusters. For details, see Configuring Mutual Trust Between MRS Clusters and Enabling MRS Inter-Cluster Replication.
- The node where the HBase cluster client is deployed can correctly resolve the host names of all nodes in the two clusters. This means that the /etc/hosts file must include the mapping between the host names and service IP addresses for all hosts in the two clusters, with host names and IP addresses in a one-on-one correspondence.
Submitting a Cross-Cluster HBase BulkLoad Job
- Use the HDFS client of the YARN cluster to upload the BulkLoad data file to the HDFS of the YARN cluster. For details, see Using the HDFS Client.
The YARN cluster refers to the cluster that runs MapReduce jobs of BulkLoad. The HBase cluster is the cluster where the generated HFile files are imported.
- Log in to the FusionInsight Manager of the HBase and YARN clusters, respectively. On the homepage, click Download Client. Set Select Client Type to Configuration Files Only and Select Download Location to Browser. Click OK to download the client configuration file to your local host and decompress it to obtain the following files:
- The ...\HBase\conf directory of the decompressed HBase cluster client configuration package:
- core-site.xml
- hbase-site.xml
- The ...\Yarn\conf directory of the decompressed YARN cluster client configuration package:
- core-site.xml
- hdfs-site.xml
- yarn-site.xml
- mapred-site.xml
- The ...\HBase\conf directory of the decompressed HBase cluster client configuration package:
- Log in to the node where the HBase cluster client is deployed as the client installation user and run the following commands.
Configure environment variables.
source Client installation directory/bigdata_env
Authenticate the user. If Kerberos authentication is disabled for the cluster (the cluster is in normal mode), skip this step.
kinit Component service user
- Upload the configuration files of the HBase and YARN clusters obtained in 2 to the specified directories on the client, for example, /opt/hbase_conf and /opt/yarn_conf.
- Specify the cluster configuration using either of the following methods:
- Modify the hbase-common.xml file in the Client installation directory/HBase/hbase/conf directory of the HBase client.
<configuration> <property> <name>import.cluster.hbase.config</name> <value>/opt/hbase_conf</value> <desc>HBase cluster configuration path</desc> </property> <property> <name>import.cluster.yarn.config</name> <value>/opt/yarn_conf</value> <desc>YARN cluster configuration path</desc> </property> </configuration> - When submitting a job, use the command-line parameters import.cluster.hbase.config and import.cluster.yarn.config to specify the cluster configuration.
hbase com.huawei.hadoop.hbase.tools.bulkload.ImportData -Dimport.cluster.hbase.config=/opt/hbase_conf -Dimport.cluster.yarn.config=/opt/yarn_conf -Dimport.hfile.output="/path/for/output" <xmlfile> <tablename> <inputdir>
- Modify the hbase-common.xml file in the Client installation directory/HBase/hbase/conf directory of the HBase client.
- Submit a job by referring to the instructions provided in 7. If you specify the cluster configuration through command-line parameters, add the import.cluster.hbase.config and import.cluster.yarn.config parameters to the job submission command. Otherwise, you do not need to set any additional parameters.
- After the job execution is complete, use the DistCp command to copy the generated HFile to the specified directory of the HBase cluster. The following is an example:
hadoop distcp hdfs://clusterX/path/for/output /path/for/output
- Run the following command to import the HFile to HBase:
hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles </path/for/output> <tablename>
The following is an example:
hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles /hfile ImportTable
What is your overall rating for this page?
Thank 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