HBase安装下载与集群(高可用)

一、准备

1.1 安装zookeeper

zookeeper 安装下载与集群

1.2 安装HADOOP

hadoop搭建集群搭建

1.3下载HBase

https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/

二、正常部署

2.1 检查是否正常启动

在这里插入图片描述

2.2解压

tar -zvxf hbase-2.4.11-bin.tar.gz

2.3配置环境变量

vim /etc/profile.d/my_env.sh 
#HBASE_HOME
export HBASE_HOME=/usr/local/src/hbase/hbase-2.4.11
export PATH=$HBASE_HOME/bin:$PATH                          

在这里插入图片描述
source环境变量

source /etc/profile.d/my_env.sh

2.4修改配置

2.4.1 配置hbase-env.sh 不使用habse自带的zookeeper

vim  $HBASE_HOME/conf/hbase-env.sh
export HBASE_MANAGES_ZK=false

在这里插入图片描述

2.4.2 配置habse-site.xml

 vim  $HBASE_HOME/conf/hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<configuration>
    <!--
      The following properties are set for running HBase as a single process on a
      developer workstation. With this configuration, HBase is running in
      "stand-alone" mode and without a distributed file system. In this mode, and
      without further configuration, HBase and ZooKeeper data are stored on the
      local filesystem, in a path under the value configured for `hbase.tmp.dir`.
      This value is overridden from its default value of `/tmp` because many
      systems clean `/tmp` on a regular basis. Instead, it points to a path within
      this HBase installation directory.

      Running against the `LocalFileSystem`, as opposed to a distributed
      filesystem, runs the risk of data integrity issues and data loss. Normally
      HBase will refuse to run in such an environment. Setting
      `hbase.unsafe.stream.capability.enforce` to `false` overrides this behavior,
      permitting operation. This configuration is for the developer workstation
      only and __should not be used in production!__

      See also https://hbase.apache.org/book.html#standalone_dist
    -->
    <property>
        <name>hbase.zookeeper.quorum</name>
		<!--zookeeper节点-->
        <value>hadoop100,hadoop101,hadoop102</value>
        <description>The directory shared by RegionServers.
        </description>
    </property>
    <!-- <property>-->
    <!-- <name>hbase.zookeeper.property.dataDir</name>-->
    <!-- <value>/export/zookeeper</value>-->
    <!-- <description> 记得修改 ZK 的配置文件 -->
    <!-- ZK 的信息不能保存到临时文件夹-->
    <!-- </description>-->
    <!-- </property>-->
    <property>
        <name>hbase.rootdir</name>
		<!--hdfs需要根据自己情况来-->
        <value>hdfs://hadoop100:9000/hbase</value>
        <description>The directory shared by RegionServers.
        </description>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
</configuration>

配置regionservers

vim $HBASE_HOME/conf/regionserver
hadoop100
hadoop101
hadoop102

在这里插入图片描述

2.4.4 使用 Hadoop 的 jar 包,解决 HBase 和 Hadoop 的 log4j 兼容性问题

 mv $HBASE_HOME/lib/client-facing-thirdparty/slf4j-reload4j-1.7.33.jar $HBASE_HOME/lib/client-facing-thirdparty/slf4j-reload4j-1.7.33.jar.bak

2.4.5 分发给其他节点

scp -r /usr/local/src/hbase root@hadoop102:/usr/local/src
scp -r /usr/local/src/hbase root@hadoop101:/usr/local/src

环境变量

scp -r /etc/profile.d/my_env.sh root@hadoop101:/etc/profile.d
scp -r /etc/profile.d/my_env.sh root@hadoop102:/etc/profile.d

记得source环境变量

source /etc/profile.d/my_env.sh

2.5 启动

2.5.1单点启动

$HBASE_HOME/bin/hbase-daemon.sh start master

2.5.2 群启

$HBASE_HOME/bin/start-hbase.sh 

2.6 报错

Error: JAVA_HOME is not set

在这里插入图片描述

2.6.1原因是没配置JAVA_HOME

vim $HBASE_HOME/conf/hbase-env.sh 
export JAVA_HOME=/usr/local/software/jdk/jdk1.8.0_131/

在这里插入图片描述
记得要分发给其他节点,其他节点的JAVA_HOME可能也不同,需要注意

重新启动
在这里插入图片描述

Failed to load class "org.slf4j.impl.StaticLoggerBinder"

在这里插入图片描述
如果启动一直报
Defaulting to no-operation (NOP) logger implementation
请看
2.4.4 使用 Hadoop 的 jar 包,解决 HBase 和 Hadoop 的 log4j 兼容性问题
如果还是有,看是哪个节点报错,直接删除,再重新把hbase重新分发过去

还是会的话
我看是102节点有问题,
我把102节点2.4.4修改的jar包改回来,重新启动后,就可以了
在这里插入图片描述

三、高可用

vim $HBASE_HOME/conf/backup-masters

写入你需要做为备份主节点的ip
在这里插入图片描述
记得分发
重新启动
在这里插入图片描述
备份主节点的时候是还不会有region servers的信息,只有单主节点挂了,他才会拉取region servers信息
在这里插入图片描述

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
HBase是一种分布式数据库,具有高可用性的特点。它通过集群模式来实现高可用性,并确保数据的持久性和可靠性。 首先,HBase采用了主从架构,集群中的每个RegionServer都可以担任主节点或从节点的角色。当主节点发生故障时,可以通过选举算法快速选出新的主节点,保证集群的服务不中断。这种架构使得HBase具备了自动故障转移和容错能力。 其次,HBase还支持数据的冗余备份。在集群中,每个Region都会有多个副本,这些副本可以分布在不同的机器上,甚至可以分布在不同的数据中心。当某个节点或数据中心发生故障时,系统可以自动切换到其他可用的副本,保证数据的可用性和一致性。 此外,HBase还提供了数据的一致性和持久性保证。在写入数据时,HBase会先将数据写入WAL(Write-Ahead Log)中,确保数据的持久化。同时,HBase还支持事务和ACID(原子性、一致性、隔离性和持久性)特性,可以保证多个操作之间的一致性。 最后,HBase还提供了监控和管理功能,可以实时监控集群的状态和性能指标,并提供自动伸缩和负载均衡的功能。这些功能可以帮助管理员及时发现问题并采取相应的措施,提高集群的可用性和性能。 综上所述,HBase集群具备高可用性的特点,通过主从架构、数据备份、故障转移、一致性保证和监控管理等措施,确保了数据的持久性、可靠性和可用性,适用于对数据一致性要求较高的场景。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值