1、 HBase安装部署
安装包:链接: 百度网盘 请输入提取码 提取码: 5up7
1.1、 Zookeeper正常部署
首先保证Zookeeper集群的正常部署,并启动之。
[shuidi@hadoop102 zookeeper-3.7.1]$ bin/zkServer.sh start
[shuidi@hadoop103 zookeeper-3.7.1]$ bin/zkServer.sh start
[shuidi@hadoop104 zookeeper-3.7.1]$ bin/zkServer.sh start
[shuidi@hadoop102 ~]$ jpsall
=============== hadoop102 ===============
26895 org.apache.zookeeper.server.quorum.QuorumPeerMain /opt/module/zookeeper/bin/../conf/zoo.cfg
=============== hadoop103 ===============
1262 org.apache.zookeeper.server.quorum.QuorumPeerMain /opt/module/zookeeper/bin/../conf/zoo.cfg
=============== hadoop104 ===============
28571 org.apache.zookeeper.server.quorum.QuorumPeerMain /opt/module/zookeeper/bin/../conf/zoo.cfg
1.2、 Hadoop正常部署
Hadoop集群的正常部署并启动。
[shuidi@hadoop102 hadoop-3.3.4]$ sbin/start-dfs.sh
[shuidi@hadoop103 hadoop-3.3.4]$ sbin/start-yarn.sh
[shuidi@hadoop102 ~]$ jpsall
=============== hadoop102 ===============
9926 org.apache.hadoop.hdfs.server.datanode.DataNode
11529 org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer
11053 org.apache.hadoop.yarn.server.nodemanager.NodeManager
9518 org.apache.hadoop.hdfs.server.namenode.NameNode
=============== hadoop103 ===============
7280 org.apache.hadoop.hdfs.server.datanode.DataNode
8522 org.apache.hadoop.yarn.server.nodemanager.NodeManager
8079 org.apache.hadoop.yarn.server.resourcemanager.ResourceManager
=============== hadoop104 ===============
28768 org.apache.hadoop.hdfs.server.datanode.DataNode
28973 org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode
29215 org.apache.hadoop.yarn.server.nodemanager.NodeManager
1.3、 HBase的解压
1)解压Hbase到指定目录
[shuidi@hadoop102 software]$ tar -zxvf hbase-2.4.11-bin.tar.gz -C /opt/module/
[shuidi@hadoop102 module]$ mv /opt/module/hbase-2.4.11 /opt/module/hbase
2)配置环境变量
[shuidi@hadoop102 module]$ sudo vim /etc/profile.d/my_env.sh
添加
#HBASE_HOME
export HBASE_HOME=/opt/module/hbase
export PATH=$PATH:$HBASE_HOME/bin
3)使用source让配置的环境变量生效
[shuidi@hadoop102 module]$ source /etc/profile.d/my_env.sh
1.4 、HBase的配置文件
1)hbase-env.sh修改内容,可以添加到最后:
[shuidi@hadoop102 conf]$ vim /opt/module/hbase/conf/hbase-env.sh
export HBASE_MANAGES_ZK=false
2)hbase-site.xml修改内容:
[shuidi@hadoop102 conf]$ vim /opt/module/hbase/conf/hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop102,hadoop103,hadoop104</value>
<description>The directory shared by RegionServers.</description>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://hadoop102:8020/hbase</value>
<description>The directory shared by RegionServers.</description>
</property>
<property>
<name>hbase.wal.provider</name>
<value>filesystem</value>
</property>
</configuration>
3)regionservers
[shuidi@hadoop102 conf]$ vim /opt/module/hbase/conf/regionservers
hadoop102
hadoop103
hadoop104
4)解决HBase和Hadoop的log4j兼容性问题,修改HBase的jar包,使用Hadoop的jar包
mv /opt/module/hbase/lib/client-facing-thirdparty/slf4j-reload4j-1.7.33.jar /opt/module/hbase/lib/client-facing-thirdparty/slf4j-reload4j-1.7.33.jar.bak
1.5、 HBase远程发送到其他集群
[shuidi@hadoop102 module]$ xsync hbase/
1.6、 HBase服务的启动
1)单点启动(我们不用)
[shuidi@hadoop102 hbase]$ bin/hbase-daemon.sh start master
[shuidi@hadoop102 hbase]$ bin/hbase-daemon.sh start regionserver
2)群启
[shuidi@hadoop102 hbase]$ bin/start-hbase.sh
running master, logging to /opt/module/hbase/logs/hbase-shuidi-master-hadoop102.out
hadoop104: running regionserver, logging to /opt/module/hbase/bin/../logs/hbase-shuidi-regionserver-hadoop104.out
hadoop102: running regionserver, logging to /opt/module/hbase/logs/hbase-shuidi-regionserver-hadoop102.out
hadoop103: running regionserver, logging to /opt/module/hbase/bin/../logs/hbase-shuidi-regionserver-hadoop103.out
3)对应的停止服务
[shuidi@hadoop102 hbase]$ bin/stop-hbase.sh
1.7、 查看HBase页面
启动成功后,可以通过“host:port”的方式来访问HBase管理页面,例如:
1.8、 高可用(可选)
在HBase中HMaster负责监控HRegionServer的生命周期,均衡RegionServer的负载,如果HMaster挂掉了,那么整个HBase集群将陷入不健康的状态,并且此时的工作状态并不会维持太久。所以HBase支持对HMaster的高可用配置。
1)关闭HBase集群(如果没有开启则跳过此步)
[shuidi@hadoop102 hbase]$ bin/stop-hbase.sh
stopping hbase..........
2)在conf目录下创建backup-masters文件
[shuidi@hadoop102 hbase]$ touch conf/backup-masters
3)在backup-masters文件中配置高可用HMaster节点
[shuidi@hadoop102 hbase]$ echo hadoop103 > conf/backup-masters
4)将整个conf目录scp到其他节点
[shuidi@hadoop102 hbase]$ xsync conf
5)重启hbase,打开页面测试查看