Hbase安装使用

Posted 全力付出

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hbase安装使用相关的知识,希望对你有一定的参考价值。

Hbase安装使用

安装环境:MAC OS

一、下载

http://mirror.bit.edu.cn/apache/hbase/stable/hbase-1.2.6.1-bin.tar.gz

二、解压安装

1)解压并进入hbase-1.2.6.1目录

tar xzvf hbase-1.2.6.1-bin.tar.gz
cd hbase-1.2.6.1

2)配置JAVA_HONE和打开自带zookeeper参数HBASE_MANAGES_ZK,编辑hbase-env.sh文件

# The java implementation to use.  Java 1.7+ required.
export JAVA_HOME=`/usr/libexec/java_home`
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=true

3)配置hbase数据存储路径,编辑conf/hbase-site.xml文件

<property>
    <name>hbase.rootdir</name>
    <value>file:///Users/zhengyong/hbase/database</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/Users/zhengyong/hbase/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>

3) 启动zookeeper

4) 启动hbase

➜  bin ./start-hbase.sh
starting master, logging to /Users/zhengyong/Development/hbase-1.2.6.1/bin/../logs/hbase-zhengyong-master-zhengyongdeMacBook-Air.local.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0

5) 使用shell客户端连接hbase

➜  bin ./hbase shell
2018-08-03 14:40:07,272 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.6.1, rUnknown, Sun Jun  3 23:19:26 CDT 2018

hbase(main):001:0>

6) 执行命令

hbase(main):001:0> create 'test', 'cf'
0 row(s) in 1.8050 seconds

=> Hbase::Table - test
hbase(main):002:0> list
TABLE
test
1 row(s) in 0.0550 seconds

=> ["test"]
hbase(main):003:0> describe 'test'
Table test is ENABLED
test
COLUMN FAMILIES DESCRIPTION
NAME => 'cf', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE',
DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE =>
'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'
1 row(s) in 0.1960 seconds

hbase(main):004:0>

7) Hbase webUI

http://localhost:16010/master-status

三、参考文献

https://hbase.apache.org/book.html

以上是关于Hbase安装使用的主要内容,如果未能解决你的问题,请参考以下文章

HBase安装

HBase安装配置

hbase单机安装

hbase 安装及常用命令使用

Ubuntu下为Hadoop安装配置Hbase教程

学习必备——HBase安装