基础准备
- JDK
- Hadoop
- SSH Server
下载HBase
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
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre/
单机模式配置
vi hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///tmp/hbase-${user.name}/hbase</value>
</property>
</configuration>
伪分布模式配置
vi hbase-site.xml
<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:
./start-all.sh
Hbase启停
启停:
./bin/start-hbase.sh
./bin/stop-hbase.sh
查看进程:
jps
WEB控制台:
http://localhost:45005/master-status
HBase Shell
./bin/hbase shell
help
常用命令:
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