BlueXIII's Blog

热爱技术,持续学习

0%

Ubuntu16.04下HBase安装笔记

基础准备

  • JDK
  • Hadoop
  • SSH Server

下载HBase

https://hbase.apache.org/

1
2
tar -zxvf hbase-1.4.2-bin.tar.gz
sudo mv hbase-1.4.2 /opt/hbase

系统环境变量

export HBASE_MANAGES_ZK=true
export HBASE_HOME=/opt/hbase
export PATH=$PATH:/opt/hbase/bin

写死JAVA_HOME

vi ./conf/hbase-env.sh

1
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre/

单机模式配置

vi hbase-site.xml

1
2
3
4
5
6
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///tmp/hbase-${user.name}/hbase</value>
</property>
</configuration>

伪分布模式配置

vi hbase-site.xml

1
2
3
4
5
6
7
8
9
10
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
</configuration>

启动Hadoop:

1
./start-all.sh

Hbase启停

启停:

1
2
./bin/start-hbase.sh
./bin/stop-hbase.sh

查看进程:

1
jps

WEB控制台:
http://localhost:45005/master-status

HBase Shell

1
2
./bin/hbase shell
help

常用命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
status
create 'test', 'cf'
list 'test'
describe 'test'

disable 'test'
drop 'test'
exists 'test'

put 'test', 'row1', 'cf:a', 'value1'
put 'test', 'row2', 'cf:b', 'value2'
put 'test', 'row3', 'cf:c', 'value3'

scan 'test'
get 'test', 'row1'

参考文档

https://www.jianshu.com/p/8818e8d40da4
https://www.jianshu.com/p/352213f109e5
https://www.shiyanlou.com/courses/37
https://www.ibm.com/developerworks/cn/analytics/library/ba-cn-bigdata-hbase/index.html