Apache HBase的集群环境搭建

前言: 对于Hbase我安装的是2.1.0版本,你们想安装其他的版本,可以自行去Hbase官网下载, HBase官网

1. 上传丶解压

tar -xvzf hbase-2.1.0.tar.gz -C  /export/server/

2. HBase配置文件的修改

1) hbase-env.sh

cd /export/server/hbase-2.1.0/conf
vim hbase-env.sh
# 第28行
export JAVA_HOME=/export/server/jdk1.8.0_241/   #自己安装JDK版本以及目录
export HBASE_MANAGES_ZK=false

2) hbase-site.xml
vim hbase-site.xml

<configuration>
        <!-- HBase数据在HDFS中的存放的路径 -->
        <property>
            <name>hbase.rootdir</name>
            <value>hdfs://node1.xxyl.cn:8020/hbase</value>
        </property>  #自己配置的域名
        <!-- Hbase的运行模式。false是单机模式,true是分布式模式。若为false,Hbase和Zookeeper会运行在同一个JVM里面 -->
        <property>
            <name>hbase.cluster.distributed</name>
            <value>true</value>
        </property>
        <!-- ZooKeeper的地址 -->
        <property>
            <name>hbase.zookeeper.quorum</name>
            <value>node1.xxyl.cn,node2.xxyl.cn,node3.xxxyl.cn</value>
        </property> #自己配置的三台主机域名
        <!-- ZooKeeper快照的存储位置 -->
        <property>
            <name>hbase.zookeeper.property.dataDir</name>
            <value>/export/server/apache-zookeeper-3.6.0-bin/data</value>
        </property>
        <!--  V2.1版本,在分布式情况下, 设置为false -->
        <property>
            <name>hbase.unsafe.stream.capability.enforce</name>
            <value>false</value>
        </property>
</configuration>


3) 修改regionservers文件
vim regionservers 

afu01.xxyl.cn     #自己设置的域名地址
afu02.xxyl.cn
afu03.xxyl.cn

3. 配置环境变量

# 配置Hbase环境变量
vim /etc/profile
export HBASE_HOME=/export/server/hbase-2.1.0
export PATH=$PATH:${HBASE_HOME}/bin:${HBASE_HOME}/sbin

#加载环境变量
source /etc/profile

4. 复制HBase的jar包到lib

cp $HBASE_HOME/lib/client-facing-thirdparty/htrace-core-3.1.0-incubating.jar $HBASE_HOME/lib/

5.分发安装包与配置文件

cd /export/server
scp -r hbase-2.1.0/ afu02.xxyl.cn:$PWD
scp -r hbase-2.1.0/ afu03.xxyl.cn:$PWD

备注:分发不成功的话查看自己配置的hostname
vim  /etc/hosts
vim /etc/hostname

在node2和node3配置加载环境变量
source /etc/profile

6. 启动HBase

cd /export/server
# 启动ZK
./start-zk.sh
# 启动hadoop
start-dfs.sh
# 启动hbase
start-hbase.sh

7. 验证HBase是否启动成功

# 启动hbase shell客户端
hbase shell
# 输入status

[root@node1 onekey]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/hadoop-2.7.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hbase-2.1.0/lib/client-facing-thirdparty/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 Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
Version 2.1.0, re1673bb0bbfea21d6e5dba73e013b09b8b49b89b, Tue Jul 10 17:26:48 CST 2018
Took 0.0034 seconds                                                                                                                                           
Ignoring executable-hooks-1.6.0 because its extensions are not built. Try: gem pristine executable-hooks --version 1.6.0
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
2.4.1 :001 > status
1 active master, 0 backup masters, 3 servers, 0 dead, 0.6667 average load
Took 0.4562 seconds                                                                                                                                           
2.4.1 :002 >

8. Hbase的webUI访问

http://node1.xxyl.cn:16010/master-status #配置的域名

Apache HBase的集群环境搭建_第1张图片

你可能感兴趣的:(Flink)