win10安装Hbase遇到的问题

最近打算学习一下 Hbase 结果发现安装很麻烦,看了不少博客,windows还是比较麻烦,磕磕绊绊装好了,暂时可以用,参考了一篇文章HBase学习 (第一天) 在Win10上单机部署,其中大部分都按照这个那篇文章思路

版本

主要发现 Hbase 和 Hadoop 版本直接有依赖,终于那篇文章说了明说了版本

准备工作:

官网上https://hadoop.apache.org/releases.html 下载Hadoop,我下载的是hadoop-2.8.5版本
官网上https://hbase.apache.org/downloads.html 下载HBase, 我下载的是2.1.1的版本
下载JDK 1.8

环境变量配置:

  • java 环境配置,没得说 配置环境变量JAVA_HOME、PATH环境变量
  • 解压hadoop,配置环境变量HADOOP_HOME,为hadoop的跟目录,即bin的上一层目录,并将 %HADOOP_HOME%/bin放入PATH
  • 解压hbase,配置环境变量HBASE_HOME,为Hbase的跟目录,即bin的上一层目录,同样将%HBASE_HOME%/bin放入PATH

配置文件配置

  • hbase配置, 首先配置conf下的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.rootdir</name>
    <value>file:///E:/hbase/data</value>      // 这个路径自己根据情况设置
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>E://hbase/zookeeper_data</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>
  <property>  
        <name>hbase.cluster.distributed</name>  
        <value>false</value>  
   </property> 
   <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>5181</value>                    //zookeeper端口
    <description>指定zk的端口号</description>
  </property>
   <property>  
    <name>hbase.zookeeper.quorum</name>  
    <value>127.0.0.1</value>                
    </property>  
</configuration>

本来想使用自己的zookeeper,结果怎么都不行,还是乖乖使用自带的即 在 conf/hbase.cmd 中
set HBASE_MANAGES_ZK=true (true代表使用自带zookeeper)

  • hadoop 看了不少博客 hadoop的 配置也要和hbase一致,我是这样配了,不知道有没有用,在 hadoop根目录 \etc\hadoop\core-site.xml更改如下
<configuration>
 <property>
        <name>hbase.rootdir</name>
        <value>file:///E:/hbase/data</value>    //和hbase指定路径一致
    </property>
</configuration>

jar包缺失

这时候执行${HBASE_HOME}/}bin/hbase-start.cmd ,会出现一系列的错误,主要就是缺少包导致的.

commons-logging-1.2.jar
slf4j-api-1.7.25.jar
log4j-1.2.15.jar
slf4j-log4j12-1.7.25.jar
htrace-core4-4.0.1-incubating.jar (${HADOOP_HOME}/share/common/lib下直接拷贝就行)

如果还有其他缺包的,下载下来放到${HBASE_HOME}/lib下即可
在下载依赖jar包时,注意版本,如果拷贝后还报错,有时候可能是jar包版本不对或者版本冲突。

找不到winutils.exe

按照那个博客,的确缺失这个hadoop-common-2.8.1-bin.zip,博主给的链接是csdn,本人太穷 ,遂到github找到类似的仓库,把图中hadoop-2.8.1目录下文件拷贝到${HADOOP_HOME}/bin下即可
steveloughran/winutils

在这里插入图片描述

启动

启动 bin/start-hbase.cmd,开启hbase服务
以管理员方式打开dos窗口,进入到${HBASE_HOME}/bin,执行 hbase shell 进入到shell窗口

    创建测试表 create  'test_table','info'

     查看表      list  

     其他

       a.HBase 与Hadoop的版本对应关系参见  http://hbase.apache.org/book.html#basic.prerequisites

       b.在启动hbase shell时用管理员方式打开DOS窗口,否则可能会出现目录权限的问题
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值