简介:本篇博客是介绍怎么安装配置Hbase集群的,主要内容包括Hbase的相关网址,Hbase集群安装部署详细教程,Hbase集群高可用配置等。


Hbase相关网址

1、Hbase官网:https://hbase.apache.org/
2、Hbase下载地址:https://hbase.apache.org/downloads.html
2、Hbase相关安装部署操作文档:

Hbase安装部署

Hbase解压和配置环境变量

  • 解压Hbase压缩包
[lqs@bdc112 software]$ tar -zxvf hbase-2.0.5-bin.tar.gz -C /home/lqs/module
  • 配置环境变量
[lqs@bdc112 bin]$ sudo vim /etc/profile.d/my_env.sh
#HBASE_HOME
export HBASE_HOME=/home/lqs/module/hbase-2.0.5
export PATH=$PATH:$HBASE_HOME/bin

配置文件

1.hbase-env.sh修改内容:

[lqs@bdc112 conf]$ pwd
/home/lqs/module/hbase-2.0.5/conf
[lqs@bdc112 conf]$ vim hbase-env.sh
export HBASE_MANAGES_ZK=false

在这里插入图片描述

  • hbase-site.xml修改内容
[lqs@bdc112 conf]$ vim hbase-site.xml
<configuration>

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

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

    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>bdc112,bdc113,bdc114</value>
    </property>

</configuration>
  • regionservers 修改
[lqs@bdc112 conf]$ vim regionservers 

添加如下内容:

bdc112
bdc113
bdc114

分发Hbase到其它节点

[lqs@bdc112 module]$ xsync hbase-2.0.5/

Hbase服务启动

注意:启动Hbase前一定要启动hadoop集群和Zookeeper集群!!!

1、单点启动

[lqs@bdc112 hbase-2.0.5]$ bin/hbase-daemon.sh start master

[lqs@bdc112 hbase-2.0.5]$ bin/hbase-daemon.sh start master regionserver

2、群启

[lqs@bdc112 hbase-2.0.5]$ start-hbase.sh 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/lqs/module/hbase-2.0.5/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/lqs/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 /home/lqs/module/hbase-2.0.5/logs/hbase-lqs-master-bdc112.out
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/lqs/module/hbase-2.0.5/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/lqs/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]
bdc112: running regionserver, logging to /home/lqs/module/hbase-2.0.5/logs/hbase-lqs-regionserver-bdc112.out
bdc113: running regionserver, logging to /home/lqs/module/hbase-2.0.5/bin/../logs/hbase-lqs-regionserver-bdc113.out
bdc114: running regionserver, logging to /home/lqs/module/hbase-2.0.5/bin/../logs/hbase-lqs-regionserver-bdc114.out

3、群停

[lqs@bdc112 ~]$ stop-hbase.sh 
stopping hbase..........
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/lqs/module/hbase-2.0.5/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/lqs/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]

查看HBase页面

启动成功后,可以通过“host:port”的方式来访问HBase管理页面,例如:

http://bdc112:16010 

页面如下:
在这里插入图片描述

配置HBase集群的高可用

意义或者是作用:
在HBase中HMaster负责监控HRegionServer的生命周期,均衡RegionServer的负载,如果HMaster挂掉了,那么整个HBase集群将陷入不健康的状态,并且此时的工作状态并不会维持太久。所以HBase支持对HMaster的高可用配置。

1、关闭Hbase集群,没有开启不用管
stop-hbase.sh(需要配置好环境变量,否则只能在hbase的bin下用)
2、在conf目录下创建backup-masters文件

[lqs@bdc112 conf]$ pwd
/home/lqs/module/hbase-2.0.5/conf
[lqs@bdc112 conf]$  vim backup-masters

输入:bdc1113
注意:这个备份节点可以设置多个,且可以任意设置

3、分发到集群的其他节点

[lqs@bdc112 conf]$ pwd
/home/lqs/module/hbase-2.0.5/conf
[lqs@bdc112 conf]$ xsync backup-masters 
==================== bdc112 ====================
sending incremental file list

sent 62 bytes  received 12 bytes  148.00 bytes/sec
total size is 7  speedup is 0.09
==================== bdc113 ====================
sending incremental file list
backup-masters

sent 116 bytes  received 35 bytes  302.00 bytes/sec
total size is 7  speedup is 0.05
==================== bdc114 ====================
sending incremental file list
backup-masters

sent 116 bytes  received 35 bytes  100.67 bytes/sec
total size is 7  speedup is 0.05

4、重新群启Hbase

[lqs@bdc112 conf]$ start-hbase.sh 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/lqs/module/hbase-2.0.5/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/lqs/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 /home/lqs/module/hbase-2.0.5/logs/hbase-lqs-master-bdc112.out
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/lqs/module/hbase-2.0.5/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/lqs/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]
bdc112: running regionserver, logging to /home/lqs/module/hbase-2.0.5/logs/hbase-lqs-regionserver-bdc112.out
bdc113: running regionserver, logging to /home/lqs/module/hbase-2.0.5/bin/../logs/hbase-lqs-regionserver-bdc113.out
bdc114: running regionserver, logging to /home/lqs/module/hbase-2.0.5/bin/../logs/hbase-lqs-regionserver-bdc114.out
bdc113: running master, logging to /home/lqs/module/hbase-2.0.5/bin/../logs/hbase-lqs-master-bdc113.out

截图如下:
在这里插入图片描述

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐