VMware创建Linux虚拟机之(四)ZooKeeper&HBase完全分布式安装 下

本文涉及的产品
任务调度 XXL-JOB 版免费试用,400 元额度,开发版规格
注册配置 MSE Nacos/ZooKeeper,118元/月
云原生网关 MSE Higress,422元/月
简介: VMware创建Linux虚拟机之(四)ZooKeeper&HBase完全分布式安装 下

HBase完全分布式安装  

下载HBase安装包

Apache HBase – Apache HBase Downloads

https://hbase.apache.org/downloads.html

上传至master虚拟机并解压HBase

cd /opt/
tar -zxvf hbase-2.3.3.tar.gz
#修改权限
sudo chmod -R 777 /opt/hbase-2.3.3

配置环境变量

[root@master ~]# vim /etc/bashrc
#HBase
export HBASE_HOME=/opt/hbase-2.3.3
export PATH=$PATH:$HBASE_HOME/bin
#配置生效
[root@master ~]# source /etc/bashrc

三台虚拟机均进行此操作  

在这里我们可以使用 hbase -version  查看环境变量是否正确

[root@master ~]# hbase -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
[root@master ~]# 

配置hbase相关文件

修改及配置 hbase-2.3.3/conf  目录下的  hbase-env.sh  文件

[root@master ~]# cd /opt/hbase-3.6.2/conf
[root@master ~]# vim hbase-env.sh
#!/usr/bin/env bash
# Where log files are stored.  $HBASE_HOME/logs by default.
# export HBASE_LOG_DIR=${HBASE_HOME}/logs
# Enable remote JDWP debugging of major HBase processes. Meant for Core Developers 
# export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070"
# export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8071"
# export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8072"
# export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8073"
# export HBASE_REST_OPTS="$HBASE_REST_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8074"
# A string representing this instance of hbase. $USER by default.
# export HBASE_IDENT_STRING=$USER
# The scheduling priority for daemon processes.  See 'man nice'.
# export HBASE_NICENESS=10
# The directory where pid files are stored. /tmp by default.
export HBASE_PID_DIR=/opt/hadoop/hadoop/pids
# Seconds to sleep between slave commands.  Unset by default.  This
# can be useful in large clusters, where, e.g., slave rsyncs can
# otherwise arrive faster than the master can service them.
# export HBASE_SLAVE_SLEEP=0.1
# Tell HBase whether it should manage it's own instance of ZooKeeper or not.
# export HBASE_MANAGES_ZK=true
# The default log rolling policy is RFA, where the log file is rolled as per the size defined for the 
# RFA appender. Please refer to the log4j.properties file to see more details on this appender.
# In case one needs to do log rolling on a date change, one should set the environment property
# HBASE_ROOT_LOGGER to "<DESIRED_LOG LEVEL>,DRFA".
# For example:
# HBASE_ROOT_LOGGER=INFO,DRFA
# The reason for changing default to RFA is to avoid the boundary case of filling out disk space as 
# DRFA doesn't put any cap on the log size. Please refer to HBase-5655 for more context.
# Tell HBase whether it should include Hadoop's lib when start up,
# the default value is false,means that includes Hadoop's lib.
export HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP="true"
# Override text processing tools for use by these launch scripts.
# export GREP="${GREP-grep}"
# export SED="${SED-sed}"
export JAVA_HOME=/opt/jdk1.8.0_261 
export HBASE_HOME=/opt/hbase-2.3.3
export HBASE_MANAGES_ZK=false

其中 HBASE_MANAGES_ZK=false 表示我们使用自己安装  zookeeper  集群而不是 hbase 自带的 zookeeper 集群

修改及配置 hbase-2.3.3/conf 目录下的 hbase-site.xml 文件

[root@master ~]# vim 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>
<property>
    <name>hbase.root.dir</name>
    <value>hdfs://master:9000/hbase</value>
</property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <property>
    <name>hbase.tmp.dir</name>
    <value>./tmp</value>
  </property>
<property>
    <name>hbase.zookeeper.quorum</name>
    <value>master,slave1,slave2</value>
</property>
<property>
 <name>hbase.zookeeper.property.clientPort</name> 
         <value>2181</value>
 </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
<property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/opt/zookeeper-3.6.2</value>
  </property>
<property>
    <name>zookeeper.session.timeout</name>
    <value>300000</value>   <!--默认: 180000 :zookeeper 会话超时时间,单位是毫秒 -->
</property>
  <property>
    <name>hbase.master.maxclockskew</name>
    <value>30000</value>
</property>
</configuration>

添加 hbase 集群服务器的 ip 或者 hostname ,vi regionservers

1. [root@master ~]# vim regionservers
2. 
3. master
4. slave1
5. slave2

将以上  Hbase 文件复制到三台服务器上

scp -r /opt/hbase-2.3.3 root@slave1:/opt
scp -r /opt/hbase-2.3.3 root@slave2:/opt

完成即可  

 

启动hbase

配置完成hbase后将上面的所有文件复制到其他两台服务器上,然后使用  start-hbase.sh  命令启动hbase集群

[root@master ~]# cd /opt/hbase-2.3.3/bin/
[root@master bin]# ls
considerAsDead.sh     hbase-config.cmd        master-backup.sh          start-hbase.sh
draining_servers.rb   hbase-config.sh         region_mover.rb           stop-hbase.cmd
get-active-master.rb  hbase-daemon.sh         regionservers.sh          stop-hbase.sh
graceful_stop.sh      hbase-daemons.sh        region_status.rb          test
hbase                 hbase-jruby             replication               tmp
hbase-cleanup.sh      hirb.rb                 rolling-restart.sh        zookeepers.sh
hbase.cmd             local-master-backup.sh  shutdown_regionserver.rb
hbase-common.sh       local-regionservers.sh  start-hbase.cmd
[root@master bin]# start-hbase.sh
running master, logging to /opt/hbase-2.3.3/logs/hbase-root-master-master.out
slave1: running regionserver, logging to /opt/hbase-2.3.3/logs/hbase-root-regionserver-slave1.out
slave2: running regionserver, logging to /opt/hbase-2.3.3/logs/hbase-root-regionserver-slave2.out
master: running regionserver, logging to /opt/hbase-2.3.3/logs/hbase-root-regionserver-master.out
[root@master bin]# 

在哪台服务器使用上述命令启动则那台服务器即为 master 节点,使用 jps命令查看启动情况

[root@master bin]# jps
7281 ResourceManager
8450 HMaster
6965 SecondaryNameNode
6535 NameNode
8619 HRegionServer
7693 QuorumPeerMain
8943 Jps

slave1

[root@slave1 bin]# jps
2180 QuorumPeerMain
2509 Jps
1919 DataNode
2351 HRegionServer
[root@slave1 bin]# 

slave2

[root@slave2 ~]# jps
3441 QuorumPeerMain
3875 HRegionServer
4040 Jps
3165 DataNode
[root@slave2 ~]# 

可以看到服务器1启动和  HMaster 和 HRegionServer  进程,服务器2和服务器3启动和HRegionServer  进程。

至此大功告成!!!困扰了我一个月的难题,终于解决了!!!

🙇‍

当然,我们也可以通过Web页面查看 Hbase 集群情况 : http://IP:16010

加油(ง •_•)ง

相关实践学习
lindorm多模间数据无缝流转
展现了Lindorm多模融合能力——用kafka API写入,无缝流转在各引擎内进行数据存储和计算的实验。
云数据库HBase版使用教程
&nbsp; 相关的阿里云产品:云数据库 HBase 版 面向大数据领域的一站式NoSQL服务,100%兼容开源HBase并深度扩展,支持海量数据下的实时存储、高并发吞吐、轻SQL分析、全文检索、时序时空查询等能力,是风控、推荐、广告、物联网、车联网、Feeds流、数据大屏等场景首选数据库,是为淘宝、支付宝、菜鸟等众多阿里核心业务提供关键支撑的数据库。 了解产品详情:&nbsp;https://cn.aliyun.com/product/hbase &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
2天前
|
存储 虚拟化
【2025最新】 神奇!VMware Workstation Pro虚拟机还原与删除功能,让你轻松应对各种场景!
删除和还原VMware虚拟机的操作步骤如下: **删除虚拟机:** 1. 选择要删除的虚拟机,右键点击并选择“移除”。 2. 这仅从列表中移除虚拟机,并未彻底删除。需前往VMware默认存储路径(如 `D:\VMware\data`),找到对应虚拟机文件夹并删除。 **还原虚拟机:** 1. 若误删虚拟机列表项目,可通过右键点击空白处,选择“打开”,找到保存虚拟机的路径文件夹。 2. 选择被删除虚拟机对应的 `.vmx` 配置文件并打开,即可在列表中恢复该虚拟机。 总结:VMware虚拟机可用于模拟多种操作系统和开发环境,掌握删除与还原技巧可提高使用效率。
32 8
【2025最新】 神奇!VMware Workstation Pro虚拟机还原与删除功能,让你轻松应对各种场景!
|
2天前
|
虚拟化
【2025最新】VMware Workstation Pro 虚拟机基础配置教程,方便你的神操作!
VMware Workstation Pro 是一款强大的虚拟化工具,本文简要介绍其基本配置与操作。安装后,用户可以通过“编辑菜单 &gt; 首选项”设置虚拟机保存路径、是否显示托盘图标等全局配置。新建虚拟机时,需选择操作系统类型、配置处理器、内存、网络和硬盘等参数。建议根据主机硬件性能合理分配资源,避免过度占用。创建完成后,用户可加载 ISO 镜像文件安装所需操作系统。通过这些步骤,您可以轻松搭建并管理多个虚拟环境。
30 8
【2025最新】VMware Workstation Pro 虚拟机基础配置教程,方便你的神操作!
|
2天前
|
存储 编解码 虚拟化
【2025最新】VMware Workstation Pro 虚拟机配置与安装VMware Tools 感受它的强大~
VMware Tools 是 VMware 虚拟机中自带的一种增强工具,能够显著提升虚拟机的性能和用户体验。它提供了优化的显卡驱动程序、文件共享与拖放功能、时间同步以及跨虚拟机和宿主机的复制粘贴功能。安装 VMware Tools 可以让虚拟机在 VMware 平台上运行得更加高效,并且对于老旧系统(如 Win98、Win2000、WinXP)也能提供必要的驱动支持。每个虚拟机都需要独立安装与其操作系统版本相匹配的 VMware Tools,以确保最佳兼容性和性能表现。
30 6
【2025最新】VMware Workstation Pro 虚拟机配置与安装VMware Tools 感受它的强大~
|
3月前
|
Ubuntu 网络安全 虚拟化
VMware虚拟机ping不通原因排查及分析
下面以 VMware 虚拟机为例进行介绍。
2190 3
|
2天前
|
Web App开发 安全 Linux
【独家揭秘2025】VMware Workstation Pro虚拟机:免费安装教程大放送,一键解锁操作系统模拟神器!
VMware Workstation Pro 是由威睿(VMware)公司开发的一款功能强大的桌面虚拟化软件,允许用户在同一台物理计算机上同时运行多个操作系统,如Windows、..
17 2
【独家揭秘2025】VMware Workstation Pro虚拟机:免费安装教程大放送,一键解锁操作系统模拟神器!
|
2月前
|
存储 SpringCloudAlibaba Java
【SpringCloud Alibaba系列】一文全面解析Zookeeper安装、常用命令、JavaAPI操作、Watch事件监听、分布式锁、集群搭建、核心理论
一文全面解析Zookeeper安装、常用命令、JavaAPI操作、Watch事件监听、分布式锁、集群搭建、核心理论。
【SpringCloud Alibaba系列】一文全面解析Zookeeper安装、常用命令、JavaAPI操作、Watch事件监听、分布式锁、集群搭建、核心理论
|
3月前
|
存储 运维 NoSQL
分布式读写锁的奥义:上古世代 ZooKeeper 的进击
本文作者将介绍女娲对社区 ZooKeeper 在分布式读写锁实践细节上的思考,希望帮助大家理解分布式读写锁背后的原理。
120 11
|
5月前
|
安全 应用服务中间件 API
微服务分布式系统架构之zookeeper与dubbo-2
微服务分布式系统架构之zookeeper与dubbo-2
|
5月前
|
负载均衡 Java 应用服务中间件
微服务分布式系统架构之zookeeper与dubbor-1
微服务分布式系统架构之zookeeper与dubbor-1
|
5月前
|
存储 负载均衡 Dubbo
分布式-Zookeeper(一)
分布式-Zookeeper(一)