安装环境: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>
hbase.rootdir
file:///Users/zhengyong/hbase/database
property>
<property>
hbase.zookeeper.property.dataDir
/Users/zhengyong/hbase/zookeeper
property>
<property>
hbase.unsafe.stream.capability.enforce
false
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.
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' for list of supported commands.
Type "exit" 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