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

本文涉及的产品
云原生网关 MSE Higress,422元/月
任务调度 XXL-JOB 版免费试用,400 元额度,开发版规格
注册配置 MSE Nacos/ZooKeeper,118元/月
简介: 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
相关文章
|
10天前
|
Ubuntu Java Linux
Linux 安装 Qualcomm ® SnapdragonTM Profiler
通过本文的详细介绍,您应该已经成功在 Linux 系统上安装并配置了 Qualcomm® Snapdragon™ Profiler,并能够连接 Android 设备进行性能分析。Snapdragon Profiler 提供了丰富的工具和功能,可以帮助开发者深入了解应用程序的性能瓶颈,从而进行优化。希望本文能对您有所帮助,让您在开发过程中更高效地使用 Snapdragon Profiler 进行性能分析和优化。
41 10
|
12天前
|
Linux
Linux安装svn并启动
Linux安装svn并启动
48 10
|
1月前
|
Oracle 关系型数据库 Linux
linux8安装oracle 11g遇到的问题记录
Oracle 11g在Linux 8上安装时会遇到link编译环节的问题。官方建议忽略安装中的链接错误,安装完成后应用DBPSU 11.2.0.4.240716补丁及一次性补丁33991024,再重新编译二进制文件,并配置监听器和数据库。但因11g已退出服务期,这些补丁需付费获取。网上信息显示22年1月的PSU补丁也可解决问题,找到该补丁后按常规方式打补丁即可。如有需求或疑问可咨询我。
71 20
|
1月前
|
弹性计算 运维 Ubuntu
os-copilot在Alibaba Cloud Linux镜像下的安装与功能测试
我顺利使用了OS Copilot的 -t -f 功能,我的疑惑是在换行的时候就直接进行提问了,每次只能写一个问题,没法连续换行更有逻辑的输入问题。 我认为 -t 管道 功能有用 ,能解决环境问题的连续性操作。 我认为 -f 管道 功能有用 ,可以单独创建可连续性提问的task问题。 我认为 | 对文件直接理解在新的服务器理解有很大的帮助。 此外,我还有建议 可以在非 co 的环境下也能进行连续性的提问。
75 7
|
2月前
|
存储 SpringCloudAlibaba Java
【SpringCloud Alibaba系列】一文全面解析Zookeeper安装、常用命令、JavaAPI操作、Watch事件监听、分布式锁、集群搭建、核心理论
一文全面解析Zookeeper安装、常用命令、JavaAPI操作、Watch事件监听、分布式锁、集群搭建、核心理论。
【SpringCloud Alibaba系列】一文全面解析Zookeeper安装、常用命令、JavaAPI操作、Watch事件监听、分布式锁、集群搭建、核心理论
|
2月前
|
NoSQL 关系型数据库 MySQL
Linux安装jdk、mysql、redis
Linux安装jdk、mysql、redis
219 7
|
5月前
|
安全 应用服务中间件 API
微服务分布式系统架构之zookeeper与dubbo-2
微服务分布式系统架构之zookeeper与dubbo-2
|
5月前
|
负载均衡 Java 应用服务中间件
微服务分布式系统架构之zookeeper与dubbor-1
微服务分布式系统架构之zookeeper与dubbor-1
|
5月前
|
存储 负载均衡 Dubbo
分布式-Zookeeper(一)
分布式-Zookeeper(一)
|
3月前
|
存储 运维 NoSQL
分布式读写锁的奥义:上古世代 ZooKeeper 的进击
本文作者将介绍女娲对社区 ZooKeeper 在分布式读写锁实践细节上的思考,希望帮助大家理解分布式读写锁背后的原理。
114 11

热门文章

最新文章