Installing HBase on a Single Ubuntu Box

HBase needs Hadoop HDFS and Zookeeper together in a production cluster. So you should install Hadoop and Zookeeper first. I will add a separate post for this later. But for testing, a stand-alone running is enough.

But it is very helpful to follow or read this post to warm yourself up: http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/.

At least for best practice, you should create a dedicated user hduser for all Hadoop related work and install latest Java (now Oracle Java 7).

Steps:

  • download hbase from http://hbase.apache.org/, I download “hbase-0.92.1.tar.gz”
  • open a terminal, and type following commands
    cd /usr/local
    sudo tar -zxf /home/hadoop/Downloads/hbase-0.92.1.tar.gz (change it to your path)
    sudo chown -R hduser:hadoop hbase-0.92.1/
    sudo ln -s hbase-0.92.1 hbase
    sudo chown -R hduser:hadoop hbase
    
  • edit conf/hbase-env.sh, to set correct Java path, for example, in my system: export JAVA_HOME=/usr/lib/jvm/java-7-oracle
  • To avoid error like this: “… Unable to find a viable location to assign region …”, chang 127.0.1.1 to 127.0.0.1 in /etc/hosts
  • start Hbase in terminal:
    cd hbase
    su hduser
    hduser@ubuntu:/usr/local/hbase$ bin/start-hbase.sh
    starting master, logging to /usr/local/hbase/bin/../logs/hbase-hduser-master-ubuntu.out
    
    hduser@ubuntu:/usr/local/hbase$ bin/hbase shell
    HBase Shell; enter 'help<RETURN>' for list of supported commands.
    Type "exit<RETURN>" to leave the HBase Shell
    Version 0.92.1, r1298924, Fri Mar  9 16:58:34 UTC 2012
    
    hbase(main):001:0>
    

But, one problem of this configuration is that your hbase table is save to /tmp/hbase-${user.name} which means you’ll lose all your data whenever your server reboots (Most operating systems clear /tmp on restart). So you might want to edit conf/hbase-site.xml and set the directory you want HBase to write to, hbase.rootdir.

You can write to a local folder. Edit the conf/hbase-site.xml, replace the file path to your location:

</pre>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///home/hduser/hbase</value>
</property>
</configuration>
<pre>

Check Hbase status at: http://localhost:60030/rs-status

you can save table into HDFS, this will be discussed in later post.

Reference:

  1. http://hbase.apache.org/book/quickstart.html
Advertisements

9 thoughts on “Installing HBase on a Single Ubuntu Box

  1. Thank you!!!
    This post helped me to solve:
    “this: “… Unable to find a viable location to assign region …”, change 127.0.1.1 to 127.0.0.1 in /etc/hosts”

  2. I want to install HBase in standalone mode only ..do I need to install hadoop and zookeeper for stand alone mode installation of HBace?
    for standalone mode what shoud I set for hbase.rootdir in conf/hbase-site.xml?
    thank you

      1. on some forum I read that for distributed and Pseudo-distributed one need to install hadoop and zookeeper to hbase work. but no need to install hadoop and zookeeper for standalon HBase. please tell is it true? or i really need to install hadoop and zookeeper to install HBase even in standalone mode. I followed http://hbase.apache.org/book/quickstart.html
        this does not saying anything about hadoop and zookeeper for standalone.
        thanks 🙂

      2. It says: “This guide describes setup of a standalone HBase instance that uses the local filesystem.” Please note “local file system” not HDFS. The beauty of HBase is the distribution based on HDFS for real enterprise usage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s