1. Ensure that the following services are started in the current system

  1. Zookeeper cluster
[mayi@mayi101 zookeeper-3.5.7]$bin/ zkserver. sh start [mayi@mayi102 zookeeper-3.5.7]$bin/ zkserver. sh start [mayi @ mayi103 zookeeper - 3.5.7] $bin/zkServer. Sh startCopy the code

2. A Hadoop cluster

sbin/start-dfs.sh
sbin/start-yarn.sh
Copy the code

2. Install and deploy Hbase

1. Unpack the

Tar -zxvf hbase-2.0.5-bin.tar.gz -c /opt/moduleCopy the code

2. Configure the configuration file

  1. Modify the Hbase – env. Sh
export HBASE_MANAGES_ZK=false
Copy the code
  1. Modify the Hbase – site. XML
<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://mayi101:8020/hbase</value>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>mayi102,mayi103,mayi101</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
<property>
  <name>hbase.wal.provider</name>
  <value>filesystem</value>
</property>
</configuration>
Copy the code
  1. regionservers
mayi101
mayi102
mayi103
Copy the code
  1. Soft connection Hadoop configuration file to HBASE
[mayi @ mayi101 module] $ln -s/opt/module/hadoop - 3.1.3 / etc/hadoop/core - site. XML/opt/module/hbase/conf/core - site. XML [mayi @ mayi101 module] $ln -s/opt/module/hadoop - 3.1.3 / etc/hadoop/HDFS - site. XML/opt/module/hbase/conf/HDFS - site. XMLCopy the code

3. Send Hbase in groups to other machine nodes

xsync hbase/
Copy the code

4. Start the HBase service

  1. Startup Mode 1
[mayi@mayi101 hbase]$ bin/hbase-daemon.sh start master
[mayi@mayi101 hbase]$ bin/hbase-daemon.sh start regionserver
Copy the code

Note: If the node time is not synchronized between clusters, RegionServer cannot start and throws a ClockOutOfSyncException exception.

  1. Startup Mode 2
 bin/start-hbase.sh
Copy the code

5. The HBase service is stopped

bin/stop-hbase.sh
Copy the code

6. Check whether the startup is successful

After the HBase management page is successfully started, you can use host:port to access the HBase management page

http://mayi101:16010 
Copy the code

3. High availability

In HBase, the HMaster monitors the HRegionServer life cycle and balances the Load of HRegionServer. If the HMaster fails, the entire HBase cluster becomes unhealthy and does not work for a long time. Therefore, HBase supports ha configuration for HMaster.

  1. Stop the HBase cluster. (If the HBase cluster is not enabled, skip this step.)
[mayi@mayi101 hbase]$ bin/stop-hbase.sh
Copy the code
  1. Create the backup-masters file in the conf directory
[mayi@mayi101 hbase]$ touch conf/backup-masters
Copy the code
  1. Configure the HMaster node in the backup-masters file
[mayi@mayi101 hbase]$ echo hadoop103 > conf/backup-masters
Copy the code
  1. SCP the entire conf directory to another node
[mayi@mayi101 hbase]$ scp -r conf/ hadoop103:/opt/module/hbase/
[mayi@mayi101 hbase]$ scp -r conf/ hadoop104:/opt/module/hbase/
Copy the code
  1. Open the page test view
http://hadooo102:16010 
Copy the code