Deployment of Hbase
Deploy Hbase
Deployment and configuration of Habase (modify path according to actual situation)
Download Hbase
wget -P /export/software/ https://repo.huaweicloud.com/apache/hbase/2.6.0/hbase-2.6.0-bin.tar.gz
tar -zxvf /export/software/hbase-2.6.0-bin.tar.gz -C /export/servers/
mv /export/servers/hbase-2.6.0 /export/servers/hbase
Modify folder owner
sudo chown -R hadooper:hadooper /export/servers/hbase/
Configure environment variables for easy call at any time
sudo vim /etc/profile
Add the following at the end of the file:
export PATH=$PATH:/export/servers/hbase/bin
Refresh terminal environment variables
source /etc/profile
verify the installation
hbase version

Configure hbase-env.sh
sudo vim /export/servers/hbase/conf/hbase-env.sh
Add the following configuration
export JAVA_HOME=/export/servers/jdk
export HBASE_CLASSPATH=/export/servers/hbase/conf
export HBASE_MANAGES_ZK=false
export HBASE_USER_CLASSPATH_FIRST=true
export HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP="true"

Configure hbase-site.xml and replace everything
sudo vim /export/servers/hbase/conf/hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- 核心:HBase存储路径指向Hadoop HA集群逻辑名称(与core-site.xml一致) -->
<property>
<name>hbase.rootdir</name>
<value>hdfs://mycluster/hbase</value>
</property>
<!-- 启用分布式模式(集群/HA模式必须为true) -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- ZooKeeper集群地址(与Hadoop core-site.xml的ha.zookeeper.quorum一致) -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop01,hadoop02,hadoop03</value>
</property>
<!-- ZooKeeper客户端端口(默认2181,与集群配置一致) -->
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<!-- ZooKeeper数据目录(仅HBase内置ZooKeeper生效,独立ZooKeeper忽略此配置) -->
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/export/servers/zookeeper/data</value>
</property>
<!-- HA模式必需:禁用HDFS流能力强制检查 -->
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
<!-- 可选优化:HBase临时目录 -->
<property>
<name>hbase.tmp.dir</name>
<value>/export/servers/hbase/tmp</value>
</property>
<!-- 禁用异步 WAL -->
<property>
<name>hbase.wal.async.enabled</name>
<value>false</value>
</property>
<!-- 禁用异步 HDFS 写入(关键!)-->
<property>
<name>hbase.fs.async.impl</name>
<value></value>
</property>
</configuration>The main modifications are shown in the figure

Configure child nodes
Configure regionservers file (specify RegionServer node)
sudo vi /export/servers/hbase/conf/regionservers
Delete the original content and add the host names of all nodes
hadoop01
hadoop02
hadoop03

copy files
Hadoop’s core-site.xml file and hdfs-site.xml file are transferred to hbase’s conf directory so that Hbase can read hadoop’s running configuration
sudo cp /export/servers/hadoop/etc/hadoop/core-site.xml /export/servers/hbase/conf
sudo cp /export/servers/hadoop/etc/hadoop/hdfs-site.xml /export/servers/hbase/conf
distribution profile
Copy the configured files and hadoop directory in the main node to the child node
scp -r /etc/profile hadoop02:/tmp
scp -r /etc/profile hadoop03:/tmp
scp -r /export/servers/hbase hadoop02:/tmp
scp -r /export/servers/hbase hadoop03:/tmp
Enter child node
Execute the following instructions on each node
sudo mv /tmp/hbase /export/servers
sudo mv /tmp/profile /etc/
start
Start the HBase cluster (just start the main node)
start-hbase.sh

Start remaining nodes
Launch the second HMaster in hadoop02 Refresh terminal environment variables
source /etc/profile
hbase-daemon.sh start master

Launch the third HMaster in hadoop03 Refresh terminal environment variables
source /etc/profile
hbase-daemon.sh start master

finder
jps | grep -E 'HMaster|HRegionServer'
hadoop01

hadoop02

hadoop03

test results
Check election results
Browser access main node ip

Connect to hbase and test
hbase shell

list query test
list

If the above results occur and no error is reported, the deployment is completed Then press ctrl+D or enter exit to exit
error analysis
There are many and complex problems in Hbase. Please forcibly kill the original processes of Hbase (all nodes) before running each time, clean up the logs directory (all nodes), first run the start-hbase.sh of the main node, check whether there is an error in the logs file in the logs directory of the main node, and then run the hbase-daemon.sh start master of the child node. If there is no error in the logs file in the logs directory of the child node, then test hbase shell and observe whether the terminal outputs correctly. If not, please check the logs logs of each node again
Turn off the Hbase command normally (main node runs)
stop-hbase.sh
Force kill Hbase command (run on each node)
kill -9 $(jps | grep -E "HMaster|HRegionServer" | awk '{print $1}')
If you enjoyed this, leave a comment~