Cluster deployment of Apache HBase 1.2.12 under CentOS

Posted by sdallas411 on Sun, 24 Oct 2021 18:03:25 +0200

Cluster deployment of Apache HBase 1.2.12 under CentOS

1, Dependent environment

Pre dependency and installation

  • CentOS 7. X, JDK, Hadoop 2.7.7 cluster, zookeeper-3.4.14 cluster
  • The three node zookeeper is deployed this time. The corresponding machine hostname s are bigdata02, bigdata03 and bigdata04

The cluster planning is shown in the following table:

machineZookeeperHMasterHRegionServer
bigdata02
bigdata03
bigdata04

Download Apache HBase

  • HBase official website: http://hbase.apache.org/ Find the official website and download the HBase installation package hbase-1.2.12-bin.tar.gz
  • Recommended images for other websites: http://mirrors.hust.edu.cn/apache/hbase/
  • Official documents of corresponding versions: http://hbase.apache.org/1.2/book.html
  • If you want to download another version: http://archive.apache.org/dist/hbase/

2, Installing Apache Hbase

Create installation path

  • Create folder hbase under / path

    [root@bigdata02 /]# mkdir hbase
    
  • Put the downloaded hbase-1.2.12-bin.tar.gz into the HBase path and unzip it

    [root@bigdata02 hbase]# tar -zxvf hbase-1.2.12-bin.tar.gz
    

Modify profile

  • Modify hbase-env.sh to enter the conf path under the decompression path

    [root@bigdata02 conf]# vim hbase-env.sh
    
  • Modify the jdk path and the zk that is not applicable

    export JAVA_HOME=/usr/local/src/jdk8
    export HBASE_MANAGES_ZK=false
    
  • Modify hbase-site.xml

    [root@bigdata02 conf]# vim hbase-site.xml 
    
  • Add the following configuration:

    <property>
        <!-- appoint hbase Table data in HDFS Root path stored on -->
        <name>hbase.rootdir</name>
        <value>hdfs://bigdata02:9000/hbase</value>
    </property>
    <property>
        <!-- appoint hbase It is a distributed cluster mode -->
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <!-- appoint zookeeper Address, multiple","division -->
        <name>hbase.zookeeper.quorum</name>
        <value>bigdata02:2181,bigdata03:2181,bigdata04:2181</value>
    </property>
    
  • Here, you need to create the root path of hbase table data stored on HDFS under the HDFS path

    [root@bigdata02 conf]# hdfs dfs -mkdir /hbase
    
  • Modify regionservers

    [root@bigdata02 conf]# vim regionservers  
    # The contents are as follows:
    bigdata03
    bigdata04
    
  • Create backup masters under conf

    [root@bigdata02 conf]# touch backup-masters
    #The contents are as follows: configure the backup master node of the cluster
    bigdata04
    
  • Copy the core configuration files hdfs-site.xml and core-site.xml of hadoop cluster to the conf path

Distribute the installation package to each node

  • Go back to the HBase path and distribute the installation package to each node. Note that the installation path should be the same; Distribute the hbase-1.2.12 folder to the other two nodes bigdata03 and bigdata04 (first establish the HBase file path at bigdata03 and bigdata04 nodes)

    [root@bigdata02 hbase] # scp -r hbase-1.2.12 root@bigdata03:/hbase
    [root@bigdata02 hbase] # scp -r hbase-1.2.12 root@bigdata04:/hbase
    

Synchronize server time

  • HBase cluster has stricter time synchronization requirements than HDFS, and the difference is required to be no more than 30s

    sudo yum install -y ntpdate
    sudo ntpdate -u ntp.api.bz
    

Configure environment variables for Hbase

  • Configure the environment variables of Hbase on the three machines

    # vim /etc/profile
    export HBASE_HOME=/hbase/hbase-1.2.12
    export PATH=$JAVA_HOME/bin:$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SCALA_HOME/bin:$SPARK_HOME/bin:$HIVE_HOME/bin:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin
    
  • Make it effective

    # source /etc/profile
    

3, Start service

  • Start the service in the following order: 1.Zookeeper cluster, 2.Hadoop cluster, 3.Hive cluster (if any) and 4.Hbase cluster;

  • Start hbase here at the bigdata02 node

    [root@bigdata02 hbase] # start-hbase.sh
    

4, View startup

  • Check whether the startup is normal and successful. jps each node in turn, as follows:

  • Note: both the primary node and the standby node start the hmaster process; Each slave node starts the hregionserver process

  • By accessing the browser page: http://bigdata02:16010

5, Turn off the Hbase service

  • Execute under the bin path of the HMaster node:

    [root@bigdata04 bin]# ./hbase-daemon.sh stop master
    
  • Execute under the bin path of the HRegionServer node:

    [root@bigdata04 bin]# ./hbase-daemon.sh stop regionserver RegionServer
    

Topics: Apache CentOS HBase