当前位置:   article > 正文

Hbase下载与安装部署(一)- 独立式

hbase下载

该部署方式一般用来测试,不上生产环境

HBase运行在Java虚拟机上,因此我们需要先在服务器上安装JDK

需要注意的是,HBase与JDK有可能存在版本兼容问题,所以在安装前需要选择兼容的版本
官网版本兼容表格
我这里选择的是JDK8和HBase2.4

JDK下载

官网 https://www.oracle.com/java/technologies/downloads/#java8

jdk下载

不想官网下载也可以在我的百度网盘下载
链接:https://pan.baidu.com/s/1dkfH443MNq5_EAN-T7vDCA
提取码:o8z6

解压JDK安装包

tar -zxvf jdk-8u201-linux-x64.tar.gz
  • 1

HBase下载

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

HBase下载
HBase下载

不想官网下载也可以在我的百度网盘下载
链接:https://pan.baidu.com/s/1Xl9jG-0LcAyWchsOxMBsdw
提取码:w08r

解压HBase安装包

tar -zxvf hbase-2.4.11-bin.tar.gz
  • 1

配置环境变量

#编辑
vi /etc/profile
#配置环境变量,在文件的末尾添加如下配置
export JAVA_HOME=/usr/java/jdk1.8.0_201 #你的JDK安装位置
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
export HBASE_HOME=/hbase-2.4.11  #你的HBase安装位置
export PATH=$PATH:$HBASE_HOME/bin
#使配置生效
source /etc/profile
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

查看版本号

java -version
  • 1

在这里插入图片描述

hbase version
  • 1

在这里插入图片描述

修改HBase配置

进入hbase安装目录的conf目录下

编辑hbase-env.sh文件

添加JAVA_HOME配置

#/usr/java/jdk1.8.0_201为jdk安装路径
export JAVA_HOME=/usr/java/jdk1.8.0_201

编辑hbase-site.xml文件,这是HBase的主要配置文件

指定HBase和ZooKeeper写入数据的本地文件系统目录即可。默认情况下,在/tmp下创建一个新目录。许多服务器被配置为在重启时删除/tmp的内容,所以你应该在其他地方存储数据。以下配置将把HBase的数据存储在/home/hbase目录下

<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.cluster.distributed</name>
    <value>false</value>
  </property>
  <property>
    <name>hbase.tmp.dir</name>
    <value>./tmp</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/zookeeper</value>
  </property>
</configuration>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42

注意:上述示例中的hbase.rootdir指向本地文件系统中的一个目录。'file:/'前缀表示本地文件系统。要在现有的HDFS实例上安装HBase,则将hbase.rootdir设置为指向你实例上的目录:例如,hdfs://namenode.example.org:8020/hbase

启动HBase

进入HBase安装目录下的bin目录

执行以下命令

./start-hbase.sh
  • 1

如果一切正常,则会将消息记录到标准输出,显示HBase已成功启动
在这里插入图片描述
可以使用jps命令来验证是否有一个名为 HMaster 的进程正在运行
在这里插入图片描述
启动成功后,可以在浏览器打开http://127.0.0.1:16010查看HBase的Web UI
在这里插入图片描述
若出现如下错误,排查是否JDK和HBase的环境变量没配置好或者使配置重新生效
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/415821
推荐阅读
相关标签
  

闽ICP备14008679号