Install HBase
Successfully installed and ran HBase in full distributed mode on three nodes.
Hadoop 1.04
HBase 0.94.11
Check hduser OK.
Check SSH OK.
Check /etc/hosts setup OK.
1. Download hbase-x.y.z.tar.gz (x.y.z is the version number)
2. Extract the gz file and move the folder to /usr/local (or whatever proper location). Set hduser (or whatever user for running hbase) the owner of the folder
tar xzf hbase-x.y.z.tar.gz
sudo mv hbase-x.y.z /usr/local/hbase
chown -R hduser:hadoop /usr/local/hbase
3. Set JAVA_HOME and HADOOP_CONF_DIR in /usr/local/hbase/conf/hbase-env.sh.
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
export HADOOP_CONF_DIR=/usr/local/hadoop/conf
Set HBASE_HOME in .bashrc
export HBASE_HOME=/usr/local/hbase
export PATH=$PATH:$HBASE_HOME/bin
4. Configure /hbase/conf/hbase-site.xml.
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:54310/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDIR</name>
<value>/urs/local/hbase/zookeeper</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master, slave, slave2</value>
<description>1, 3, 5, 7 ... odd number of nodes</description>
</property>
</configuratioin>
5. Configure /hbase/conf/regionservers
master
slave
slave2
...
6. Copy /usr/local/hbase folder to all slave nodes.
6.1 zip the folder and transfer to slave & slave 2
tar czf hbase_configured.tar.gz hbase
scp hbase_configured.tar.gz hduser@slave:hbase_configured.tar.gz
6.2 unzip and configure from slave & slave2
ssh slave
tar xzf hbase_configured.tar.gz
sudo mv hbase /usr/local/hbase
chown -R hduser:hadoop /usr/local/hbase
7. Start hbase
hduser@ubuntu:/usr/local/hbase/bin$ ./start-hbase.sh
slave: starting zookeeper, logging to /usr/local/hbase/bin/../logs/hbase-hduser-zookeeper-ubuntu.out
slave2: starting zookeeper, logging to /usr/local/hbase/bin/../logs/hbase-hduser-zookeeper-ubuntu.out
master: starting zookeeper, logging to /usr/local/hbase/bin/../logs/hbase-hduser-zookeeper-ubuntu.out
starting master, logging to /usr/local/hbase/logs/hbase-hduser-master-ubuntu.out
master: starting regionserver, logging to /usr/local/hbase/bin/../logs/hbase-hduser-regionserver-ubuntu.out
slave: starting regionserver, logging to /usr/local/hbase/bin/../logs/hbase-hduser-regionserver-ubuntu.out
slave2: starting regionserver, logging to /usr/local/hbase/bin/../logs/hbase-hduser-regionserver-ubuntu.out
8. Check HBase web UI. The following URL should list all the attributes.
http://master:60010/
9. Start hbase shell
/hbase/bin/hbase shell
10. Test from the shell. List all tables. This should return 0 rows for the first time. If any error pops up the setup was not successful.
>list
8. Create a table 'test' with a column family called 'data'
>create 'test','data'
9. Insert test data into the table.
>put 'test', 'row1', 'data:column1', 'value1'
>put 'test', 'row2', 'data:column2', 'value2'
>put 'test', 'row1', 'data:column1', 'value3'
>put 'test', 'row2', 'data:column2', 'value4'
10. Show data in the table
> scan 'test'
ROW COLUMN+CELL
row1 column=data:column1, timestamp=1379360926325, value=value1
row1 column=data:column2, timestamp=1379360943922, value=value2
row2 column=data:column1, timestamp=1379360958865, value=value3
row2 column=data:column2, timestamp=1379360965475, value=value4
11. Get data from table
>get 'test', 'row1'
>get 'test', 'row1', 'data:column1'
>exit
12. Stop Hbase
/usr/local/hbase/bin/stop-hbase.sh