Nick Dimiduk

n10k.com: blog et al.

HBase Root Dir on a Mac

While working on HBase bug fixes and feature development, it’s often quite convenient to test changes on a local-mode HBase. This is done by running HBase right out of your developer sandbox. Though a lot of HBase development happens on Macs these days, it’s a system designed first to run on Linux. That means there are a couple minor annoyances for non-Linux users. Let me show you how I work around one of them.

To work on HBase, you’ll need to grab the source.

1
2
3
4
5
6
7
8
9
$ git clone --depth 1 --branch master git://git.apache.org/hbase.git
Cloning into 'hbase'...
remote: Counting objects: 3233, done.
remote: Compressing objects: 100% (2756/2756), done.
remote: Total 3233 (delta 958), reused 1264 (delta 282)
Receiving objects: 100% (3233/3233), 7.05 MiB | 1.27 MiB/s, done.
Resolving deltas: 100% (958/958), done.
Checking connectivity... done.
$ cd hbase

Now apply some changes and spin up the local-mode version.

1
2
3
4
5
6
7
8
9
// hack hack hack
$ mvn clean package -PrunSmallTests
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
$ ./bin/start-hbase.sh ; tail -f logs/hbase-ndimiduk-master-soleil.local.log
...
2014-07-11 22:27:18,748 INFO  [ActiveMasterManager] master.HMaster: Master has completed initialization

Notice the odd Root Directory: /var/folders/b8/n5n91drd7xg0rlt5n6fgsjtw0000gn/T/hbase-ndimiduk

This is a very inconvenient path, particularly when you’re testing patches targeting multiple versions of HBase that have differing on-disk and/or ZooKeeper znode formats.

By default, HBase is using java.io.tmpdir.

1
2
3
$ grep -A1 name\>hbase.tmp.dir hbase-common/src/main/resources/hbase-default.xml
    <name>hbase.tmp.dir</name>
    <value>${java.io.tmpdir}/hbase-${user.name}</value>

On the mac, this results in the path found above. I find it useful to explicitly override this setting.

1
2
3
4
5
6
7
8
$ tail -n7 conf/hbase-site.xml
<configuration>
  <property>
    <name>hbase.tmp.dir</name>
    <!-- value>${java.io.tmpdir}/hbase-${user.name}</value -->
    <value>/tmp/hbase-${user.name}</value>
  </property>
</configuration>

Now it’s much easier to remember where HBase is dropping its data.

Happy HBase-ing!

-n

« Greetings from Europe

About the Author

Nick found Hadoop and HBase in 2008 when his nightly ETL jobs started taking 20+ hours to complete. Since then, he has applied these tools to projects over social media, social gaming, click-stream analysis, climatology, and geographic data. Nick also helped establish Seattleā€™s Scalability Meetup and tried his hand at entrepreneurship. He is an HBase committer and coauthored HBase in Action, the unofficial user's guide for HBase. His passion is scalable, online access to scientific data.

Comments