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.
$ 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.
// 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.
$ 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.
$ 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