Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include hbase-site.xml in the classpath

I am currently trying to get my HBase code to use the settings specified in my hbase-site.xml. It seems to use default settings instead of what is specified in the hbase-site.xml config file. I have restarted the HBase cluster since updating the files, but it is still not using config files that I updated.

The cluster I am using is 2 nodes, one of which is the master. The config files on both of the nodes specify the IP of the master node as the zookeeper quorum. I believe the problem is that my settings specified in hbase-site.xml are not being used because the code runs fine if I set the zookeeper quorum to the same value as in my hbase-site.xml via code, but the second node cannot contact the master if the quorum is not specified via code.

config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", masterNodeIP);

I would greatly appreciate instructions or a link on how to include hbase-site.xml into my code's classpath. I develop with Eclipse on a Windows machine and have the HBase environment installed on a Linux cluster. I usually use Eclipse to compile the code, due to dependencies.

Ideally, I want each node in the cluster to use its own config file.

Thanks in advance!

like image 273
Alex Vertlieb Avatar asked Jan 14 '13 20:01

Alex Vertlieb


People also ask

Where is hbase site xml located?

In all cases of hbase the /etc/hbase/conf/hbase-site. xml file is always read. The /usr/lib/hbase/conf/hbase-site. xml is a symlink to /etc/hbase/conf/hbase-site.

What is hbase site xml?

hbase-site.xml. The path to the hbase-site. xml file that contains all the information required to connect to target HBase database (such as zookeeper quorum, port, parent znode). This file s copied from the target cluster and placed in some local directory.


1 Answers

If it's using the default regardless of what you put in your hbase-site.xml, it probably means it is being overriden by another file in your classpath. This is very possible because there is already a conf-site.xml in the hbase jar.

To fix this, edit your classpath to add the directory containing your hbase-site.xml at the end of the classpath to be sure nothing overrides it. Something like:

java -cp $CLASSPATH:/usr/lib/hbase/conf path.to.your.Mainclass

If it gets too obscure, I would advise running this from command line and not in Eclipse so you can be exactly sure of what you have in your classpath.

Hope that helps.

like image 156
Charles Menguy Avatar answered Oct 29 '22 01:10

Charles Menguy