HBase Testing Tutorial
Introduction
After you made some changes you have to run you HBase build for testing/debuging.
This tutorial is supposing that you have build your HBase project. If not look throw How to build HBase under Eclipse.
Starting Hadoop Core and ZooKeeper
HBase is working on top of Hadoop Core and using ZooKeeper service.
To start Hadoop Core use Hadoop Quick Start.
Your hadoop-site.xml should look like this:
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>To start ZooKeeper use ZooKeeper Getting Started Guide.
Your zoo.cfg should look like this:
tickTime=2000 initLimit=10 syncLimit=5 dataDir=/home/user/ZKDatadir clientPort=2181
Configure hbase-site.xml
If you used my examples for Hadoop Core and ZooKeeper configuration, then your HBase/conf/hbase-site.xml should look like this:
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>hbase.master</name>
<value>localhost:60000</value>
</property>
<property>
<name>hbase.zookeeper</name>
<value>localhost:2181//home/user/ZKDatadir</value>
</property>
</configuration>Add /conf to project CLASSPATH. Project -> Properties -> Java Build Path -> Libraries -> Add Class Folder...
- In tab Order and Export move /conf on Top (to prevent covering conf/hbase-site.xml by hbase-site.xml from other JARs/libs).
Resolving problem with webapps
- Generate HBase JAR. Use HBase/build.xml with default task JAR. It will be placed at HBase/build/hbase-0.**.*-dev.jar
Add generated JAR to CLASSPATH. Project -> Properties -> Java Build Path -> Libraries -> Add External JARs...
- In tab Order and Export move your JAR on Bottom.
Running HBase Master and Region Server
- Run HMaster as Java Application with parameter start.
Run H!RegionServer as Java Application with parameter start.
HBase is runned.
Also you can run it in debug mode.