搭建单机环境可用于HBase表、操作相关学习演示

参考地址:http://hbase.apache.org/book.html#quickstart

下载安装包

  1. 通过quickstart中下载超链接进入下载页面

image.png

  1. 下载statble版本:https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/stable/
  2. 分别下载:
    1. 服务器安装包:hbase-2.2.3-bin.tar.gz
    2. 客户端包:hbase-2.2.3-client-bin.tar.gz

安装配置服务器

  1. 解压到安装目录:/usr/local/

    1. [root@hbase111 hbase-2.2.3]# pwd
    2. /usr/local/hbase-2.2.3
    3. [root@hbase111 hbase-2.2.3]# ll
    4. 总用量 916
    5. drwxr-xr-x. 4 1001 1001 4096 1 10 17:37 bin
    6. -rw-r--r--. 1 1001 1001 157258 1 10 18:15 CHANGES.md
    7. drwxr-xr-x. 2 1001 1001 208 2 5 09:15 conf
    8. drwxr-xr-x. 7 1001 1001 80 1 10 18:28 hbase-webapps
    9. -rw-rw-r--. 1 1001 1001 262 5 2 2018 LEGAL
    10. drwxr-xr-x. 6 root root 8192 2 4 21:40 lib
    11. -rw-rw-r--. 1 1001 1001 129312 1 10 18:31 LICENSE.txt
    12. drwxr-xr-x. 2 root root 108 2 5 09:22 logs
    13. -rw-rw-r--. 1 1001 1001 520601 1 10 18:31 NOTICE.txt
    14. -rw-r--r--. 1 1001 1001 1477 1 10 15:03 README.txt
    15. -rw-r--r--. 1 1001 1001 98256 1 10 18:15 RELEASENOTES.md
  2. 配置JAVA_HOME:/usr/local/hbase-2.2.3/conf/hbase-env.sh

    export JAVA_HOME=/usr/local/jdk1.8.0_144/
    
  3. 配置数据存储目录:/usr/local/hbase-2.2.3/conf/hbase-site.xml

    <configuration>
    <property>
     <name>hbase.rootdir</name>
     <value>file:///home/data/hbase</value>
    </property>
    <property>
     <name>hbase.zookeeper.property.dataDir</name>
     <value>/home/data/zookeeper</value>
    </property>
    <property>
     <name>hbase.unsafe.stream.capability.enforce</name>
     <value>false</value>
     <description>
       Controls whether HBase will check for stream capabilities (hflush/hsync).
       Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
       with the 'file://' scheme, but be mindful of the NOTE below.
       WARNING: Setting this to false blinds you to potential data loss and
       inconsistent system state in the event of process and/or node failures. If
       HBase is complaining of an inability to use hsync or hflush it's most
       likely not a false positive.
     </description>
    </property>
    </configuration>
    

启动服务器

  1. 执行启动脚本:bin/start-hbase.sh

    [root@hbase111 hbase-2.2.3]# bin/start-hbase.sh 
    running master, logging to /usr/local/hbase-2.2.3/bin/../logs/hbase-root-master-hbase111.out
    
  2. 查看进程

    [root@hbase111 hbase-2.2.3]# jps
    2257 Jps
    1979 HMaster
    

停止服务器

  1. 执行停止脚本:bin/stop-hbase.sh

    [root@hbase111 hbase-2.2.3]# bin/stop-hbase.sh 
    stopping hbase.............
    
  2. 查看进程

    [root@hbase111 hbase-2.2.3]# jps
    1900 Jps
    

查看管理页面

  1. 浏览器打开地址:http://hbase111:16030

image.png
其中:hbase111为当前服务器名称,需要配置本地hosts


至此,单机版HBase环境搭建完毕!