Hbase [entry installation and high availability]

Table of contents

1. Zookeeper normal deployment

Normal deployment and startup of the Zookeeper cluster

2. Hadoop normal deployment

Normal deployment and startup of the Hadoop cluster

3. Hbase deployment

1. Download

download link: https://hbase.apache.org/downloads.html

2. Unzip

The current installation version is hbase-2.0.5, extract Hbase to the specified directory and rename it to hbase

tar -zxvf hbase-2.0.5-bin.tar.gz -C /opt/module
mv /opt/module/hbase-2.0.5 /opt/module/hbase

3. Related configuration

1) Configure environment variables

Modify my_env.sh

sudo vim /etc/profile.d/my_env.sh

Add the following

#HBASE_HOME
export HBASE_HOME=/opt/module/hbase
export PATH=$PATH:$HBASE_HOME/bin

source it

source /etc/profile

Distribute my_env.sh to other nodes and source them all

xsync /etc/profile.d/my_env.sh
source /etc/profile

2) Modify hbase-env.sh

Modify /hbase/conf/hbase-env.sh to add the following

export HBASE_MANAGES_ZK=false

3) Modify hbase-site.xml

Modified to the following

hbase.rootdir: data storage path in hdfs

hbase.zookeeper.quorum: zookeeper cluster node

	<property>
		<name>hbase.rootdir</name>
		<value>hdfs://hadoop102:8020/HBase</value>
	</property>

	<property>
		<name>hbase.cluster.distributed</name>
		<value>true</value>
	</property>

	<property>
		<name>hbase.zookeeper.quorum</name>
		<value>hadoop102,hadoop103,hadoop104</value>
	</property>
	<property>
         <name>hbase.unsafe.stream.capability.enforce</name>
         <value>false</value>
    </property>

4) Modify the regionservers file

Hregionserver node configuration, add the following

hadoop102
hadoop103
hadoop104

4. Distribute files

xsync hbase/

5. Start, shut down

Method 1: Get together

[hadoop@hadoop102 hbase]$ bin/start-hbase.sh
 The corresponding stop service:
[hadoop@hadoop102 hbase]$ bin/stop-hbase.sh

Method 2: Each node starts independently

[hadoop@hadoop102 hbase]$ bin/hbase-daemon.sh start master
[hadoop@hadoop102 hbase]$ bin/hbase-daemon.sh start regionserver

Note: Which node to start the master on, which node is the Hmaster.

Tip: If the node time between clusters is not synchronized, the regionserver will fail to start and a ClockOutOfSyncException will be thrown.

Repair method

a. Synchronized time service

b. Attribute: hbase.master.maxclockskew set a larger value

<property>
        <name>hbase.master.maxclockskew</name>
        <value>180000</value>
        <description>Time difference of regionserver from master</description>
</property>

6. Verify

Start hbase (start zookeeper and hdfs first)

[hadoop@hadoop102 ~]$ start-hbase.sh 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/hbase/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop-3.1.3/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
running master, logging to /opt/module/hbase/logs/hbase-atguigu-master-hadoop102.out
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/hbase/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop-3.1.3/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
hadoop104: running regionserver, logging to /opt/module/hbase/logs/hbase-atguigu-regionserver-hadoop104.out
hadoop103: running regionserver, logging to /opt/module/hbase/logs/hbase-atguigu-regionserver-hadoop103.out
hadoop102: running regionserver, logging to /opt/module/hbase/logs/hbase-atguigu-regionserver-hadoop102.out
hadoop103: running master, logging to /opt/module/hbase/logs/hbase-atguigu-master-hadoop103.out

jps take a look

[hadoop@hadoop102 ~]$ myjps
================  hadoop102  =====================
3364 NameNode
3497 DataNode
24106 Jps
3117 QuorumPeerMain
23678 HRegionServer
23487 HMaster
================  hadoop103  =====================
2024 DataNode
1882 QuorumPeerMain
11037 HRegionServer
11533 Jps
================  hadoop104  =====================
9536 Jps
1879 QuorumPeerMain
9290 HRegionServer
2124 SecondaryNameNode
2014 DataNode

Visit page: http://hadoop102:16010

4. High availability of HMaster

Purpose: to add hadoop103 as the standby node of Hmaster

1) Close the hbase cluster in hadoop102

stop-hbase.sh

2) Add the backup-masters file under %hbase_home%/conf

 vim hbase/conf/backup-masters

Add the following

hadoop103

3) Distribute the backup-masters file to other nodes

xsync hbase/conf/backup-masters

4) Start the cluster in hadoop102

start-hbase.sh

5) Observe the web page:

http://hadoop102:16010

http://hadoop103:16010

6) Verify

kill the hmaster of hadoop102

[hadoop@hadoop102 module]$ jps
3364 NameNode
3497 DataNode
3117 QuorumPeerMain
23678 HRegionServer
23487 HMaster
24239 Jps
[hadoop@hadoop102 module]$ kill -9 23487

observe hadoop103

Tags: HBase

Posted by theslug on Wed, 01 Jun 2022 05:18:50 +0530