Hbase Cluster Setup Guide
Environment:
1.
2.
3.
4.
5.
Preparation
1.
Set the number of the files all at the same time in memory. Default is 1024.
a.
hduser – nofile 32768
b.
session required pam_limits.so
2.
$ sudo apt-get update
$ sudo apt-get install maven
3.
a)
$ tar –zxvf hbase-0.94.8-security.tar.gz
$ sudo mv hbase-0.94.8-security /usr/local/hbase94
$ sudo chmod –R hduser:hduser /usr/local/hbase94
b)
c)
d)
4.
$ sudo atp-get install ntp
$ sudo service ntp stop
$ sudo ntpdate –u ntp.ubuntu.com
$ sudo service ntp start
5.
Configure the property for hadoop in hdfs-site.xml
configuration
Standalone HBASE
Don’t use HDFS to store the database files. It uses local file system.
$ tar –zxvf hbase-0.94.8.tar.gz
$sudo mv hbase-0.94.8 /usr/local/ hbase-0.94.8
$sudo chmod –R hduser:hduser /usr/local/ hbase-0.94.8
Make directory for hbase.root and hbase.zookeeper.property.dataDir
$sudo mkdir /home/hbase
$sudo mkdir /home/zookeeper
$sudo chmod –R hduser:hduser /home/hbase
$sudo chmod –R hduser:hduser /home/zookeeper
Edit /usr/local/ hbase-0.94.8/conf/hbase-site.xml. Set hbase.root and hbase.zookeeper.property.dataDir
Pseudo-distributed
A pseudo-distributed mode is simply a distributed mode run on a single host. Use this configuration testing and prototyping on HBase. Do not use this configuration for production nor for evaluating HBase performance. Here will not provide the way to configure it.
Fully-distributed
1 regionserver
$ tar –zxvf hbase-0.94.8.tar.gz
$sudo mv hbase-0.94.8 /usr/local/hbase-0.94.8
$sudo chmod –R hduser:hduser /usr/local/hbase-0.94.84
$ /user/local/hadoop/bin/hdfs dfs –mkdir hdfs://master:8888/hbase
a.
u
u
u
b.
Restart hadoop to source it.
$ cd /usr/local/hbase-0.94.8
$ vi conf/hbase-site.xml
$ vi conf/regionservers
master
export JAVA_HOME = /usr/local/jdk1.7
2 regionservers
Master:
$ vi conf/regionservers
master
slave
Slave
1.
$ tar –zxvf hbase-0.94.8.tar.gz
$sudo mv hbase-0.94.8 /usr/local/hbase-0.94.8
$sudo chmod –R hduser:hduser /usr/local/hbase-0.94.84
2.
$ vi conf/regionserver
3.
Start/Stop hbase
1.
$ bin/start-hbase.sh
$ jps
3 services will be added in java process:
2.
$ bin/stop-hbase.sh
Practice Hbase
1.
$ bin/hbase shell
2.
hbase(main) :001:0> create ‘test’,’cf’
3.
hbase(main) :001:0> put 'test', 'row1', 'cf:a', 'value1'
hbase(main) :001:0> put 'test', 'row2', 'cf:b', 'value2'
hbase(main) :001:0> put 'test', 'row3', 'cf:c', 'value3'
4.
hbase(main) :001:0>
ROW
row1
row2
row3
3 row(s) in 0.0590 seconds
5.
hbase(main):012:0> disable 'test'
0 row(s) in 1.0930 seconds
hbase(main):013:0> drop 'test'
0 row(s) in 0.0770 seconds