Friday, January 16, 2015

Ubuntu Server 14.04 - Install HBase 0.98.9

Following these steps to install HBase

A. Prerequisites:
- Installed Hadoop 2.x (if not, see this link: Install single node Hadoop 2.4.0)
- Installed JDK 1.7.x (if not see this link: Install JDK 1.7.x)

B. Steps:
1. Download HBase (version HBase v0.98.9)
1
root@ubuntu:~# wget http://mirrors.viethosting.vn/apache/hbase/hbase-0.98.9/hbase-0.98.9-hadoop2-bin.tar.gz

2. Unzip this downloaded package
1
root@ubuntu:~# tar zxvf hbase-0.98.9-hadoop2-bin.tar.gz

3. Rename and move to this folder
1
2
root@ubuntu:~# mv /root/hbase-0.98.9-hadoop2 /root/hbase
root@ubuntu:~# mv /root/hbase /usr/local/

4. Change owner for hduser account
1
root@ubuntu:~# chown -R hduser:hadoop /usr/local/hbase 

5. Config hbase-site.xml file
1
hduser@ubuntu:~$ vi /usr/local/hbase/conf/hbase-site.xml
Add these configuration and then save
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<configuration>
   <property>
      <name>hbase.rootdir</name>
      <value>file:///usr/local/hbase/hbase-data</value>
   </property>
   <property>
      <name>hbase.zookeeper.property.dataDir</name>
      <value>/usr/local/hbase/zookeeper</value>
   </property>
   <property>
      <name>dfs.replication</name>
      <value>1</value>
   </property>
   <property>
      <name>hbase.zookeeper.property.clientPort</name>
      <value>2222</value>
   </property>
   <property>
      <name>hbase.zookeeper.quorum</name>
      <value>localhost</value>
   </property>
</configuration>

6. Uncomment this configuration in hbase-env-sh to allow HBase manage it's own instance of Zookeeper
1
hduser@ubuntu:~$ vi /usr/local/hbase/conf/hbase-env.sh
1
export HBASE_MANAGES_ZK=true

7. Update ~/.profile
1
hduser@ubuntu:~$ vi ~/.profile
1
2
3
4
# Add to the end of the file
export HBASE_HOME=/usr/local/hbase
export JAVA_HOME=/usr/local/java/jkd1.7.0_71
export PATH="$JAVA_HOME/bin:$HBASE_HOME/bin:/usr/local/bin:/usr/local/sbin:$PATH"
Update enviroment
1
hduser@ubuntu:~$ source ~/.profile

8. Start HBase
1
2
hduser@ubuntu:~$ start-hbase.sh
starting master, logging to /usr/local/hbase/logs/hbase-hduser-master-ubuntu.out
Importance: We must start Hadoop first

9. Check if it's running
1
2
3
4
hduser@ubuntu:~$ ps -ef|grep hbase
hduser     4766      1  0 10:33 pts/0    00:00:00 bash /usr/local/hbase/bin/hbase-daemon.sh --config /usr/local/hbase/conf internal_start master
hduser     4780   4766 10 10:33 pts/0    00:00:11 /usr/local/java/jdk1.7.0_71/bin/java -Dproc_master -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/usr/local/hbase/logs -Dhbase.log.file=hbase-hduser-master-ubuntu.log -Dhbase.home.dir=/usr/local/hbase -Dhbase.id.str=hduser -Dhbase.root.logger=INFO,RFA -Djava.library.path=/usr/local/hadoop/lib/native -Dhbase.security.logger=INFO,RFAS org.apache.hadoop.hbase.master.HMaster start
hduser     5025   4297  0 10:34 pts/0    00:00:00 grep --color=auto hbase

10. Now, we can go to HBase shell to work
1
2
3
4
5
6
7
hduser@ubuntu:~$ hbase shell
2015-01-16 10:36:07,958 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.9-hadoop2, r96878ece501b0643e879254645d7f3a40eaf101f, Mon Dec 15 23:00:20 PST 2014

hbase(main):001:0>
Or we can use HBase web-based at: http://localhost:60010