1.上传tar包
hbase-2.2.2-bin.tar.gz
2.解压tar包
# 解压目录
tar -xzvf hbase-2.2.2-bin.tar.gz
# 删除docs目录
rm -rf docs/
3.添加hbase的环境变量
进入 /etc/profile文件
vim /etc/profile
添加以下内容
#HBASE_HOME
export HBASE_HOME=/opt/hbase-2.2.2
export PATH=$PATH:$HBASE_HOME/bin
使配置环境生效
source /etc/profile
查看是否生效
hbase version
4.进入hbase的 conf 文件
cd hbase-2.2.2/conf
5.修改配置文件:hbase-env.sh
export HBASE_MANAGES_ZK=false
export JAVA_HOME=/usr/java/jdk1.8.0_221-amd64
6.修改配置文件:regionservers (配置的是regionserver)
node1
node2
node3
7.修改配置文件:backup-masters (配置的是backup-masters)
cp regionservers backup-masters
添加以下内容
node2
8.修改配置文件:hbase-site.xml (配置的是备用节点)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<!--
file://表示的是本地目录
hdfs://表示的是hdfs的目录;
hdfs://namenode.example.org:/hbase(一定是active的namenode)
-->
<value>hdfs://node1(namenode存活的hostname):9000/hbase</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
<description>检查兼容性,如果设置为false,数据有可能丢失(这是一个警告) Controls whether HBase will check for stream capabilities (hflush/hsync) Disable this if you intend to run on LocalFileSystem, denoted by a rootdir with the 'file://' scheme, but be mindful of the NOTE below. WARNING: Setting this to false blinds you to potential data loss and inconsistent system state in the event of process and/or node failures. If HBase is complaining of an inability to use hsync or hflush it's most likely not a false positive.
</description>
</property>
<!--配置 zookeepr-->
<property>
<name>hbase.zookeeper.quorum</name>
<value>node1:2181,node2:2181,node3:2181</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<!-- zookeeper的目录:data目录 -->
<value>/opt/zookeeper-3.4.13/data/hbase</value>
</property>
<!-- 开启集群模式 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
</configuration>
9.在想当master服务器启动hbase;(我这里用的是node1)
bin/start-hbase.sh
10.关闭hbase
bin/stop-hbase.sh
------安--装--成--功---------