Windows搭建HBase 2.0.2

时间:2022-07-28
本文章向大家介绍Windows搭建HBase 2.0.2,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

1. 环境

  • 操作系统: Windows 7
  • JDK版本: 1.8.0_221
  • Hadoop版本: 2.6.0 (HBase依赖)
  • HBase版本: 2.0.2

2. 下载

HBase官网下载

  • 官网首页
  • 下载历史版本
  • 找到对应版本进行下载

3. 前期准备

3.1 安装并启动完成HDFS

详见: Windows搭建HDFS 2.6.0(附加搭建Hadoop)

4. 安装部署

4.1. 解压,提示有异常不影响

4.2 修改.confhbase-site.xml

注意: 设置hbase.cluster.distributed=false HBase将启动内置Zookeeper(2181),HBase在Windows环境下不支持外置Zookeeper

<configuration>
    <property>
        <name>hbase.tmp.dir</name>
        <value>/E:/soft_work/hbase-2.0.2/data/tmp</value>
    </property>
    <!-- hdfs URI 要使用localhost, 不能使用127.0.0.1 -->
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://localhost:8020/hbase</value>
    </property>
    <!-- Windows不支持true, 只能填写false,设置成false之后, HBase将启动内置Zookeeper
         填写true => error message: This is not implemented yet. Stay tuned. -->
    <property>
        <name>hbase.cluster.distributed</name>
        <value>false</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>localhost</value>
    </property>
    <property>  
        <name>hbase.zookeeper.property.dataDir</name>  
        <value>/E:/soft_work/hbase-2.0.2/data/zoo</value>  
    </property>
    <!--  必须将此参数设置为false, 不然启动HBase报错, 同时会造成zookeeper启动失败
          置为true => error message: ERROR [Thread-21] master.HMaster: Failed to become active master
    -->
    <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>
    <!-- HMaster UI端口 -->
    <property>
        <name>hbase.master.info.port</name>
        <value>61510</value>
    </property>
    <!-- HRegionserver UI端口 -->
    <property>
        <name>hbase.regionserver.info.port</name>
        <value>61530</value>
    </property>
    <property>
        <name>hbase.master.port</name>
        <value>61500</value>
    </property>
    <property>
        <name>hbase.regionserver.port</name>
        <value>61520</value>
    </property>
</configuration>

4.4 启动HBase

.binstart-hbase.cmd

排坑: 启动HBase时出现SLF4J: Class path contains multiple SLF4J bindings. 解决办法: 删除掉 ${HBASE_HOME}/lib/slf4j-log4j12-1.7.25.jar 报错信息如下: E:soft_workhbase-2.0.2bin>start-hbase.cmd SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/E:/soft_work/hbase-2.0.2/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/E:/soft_work/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

4.5 启动成功 出现 Master has completed initialization

2020-10-14 15:21:22,611 INFO  [Thread-21] master.HMaster: Master has completed initialization 22.616sec
2020-10-14 15:21:22,614 INFO  [Thread-21] quotas.MasterQuotaManager: Quota support disabled
2020-10-14 15:21:22,615 INFO  [Thread-21] zookeeper.ZKWatcher: not a secure deployment, proceeding
2020-10-14 15:21:31,454 INFO  [WALProcedureStoreSyncThread] wal.WALProcedureStore: Rolled new Procedure Store WAL, id=10
2020-10-14 15:21:31,456 INFO  [WALProcedureStoreSyncThread] wal.ProcedureWALFile: Archiving hdfs://localhost:8020/hbase/MasterProcWALs/pv2-00000000000000000009.log to hdfs://localhost:8020/hbase/oldWALs/pv2-00000000000000000009.log
  • HMaster-UI

http://localhost:61510/