How to include hbase-site.xml in the classpath

I'm currently trying to get my HBase code to use the settings specified in my hbase-site.xml. It seems to use the default settings instead of what is specified in the hbase-site.xml configuration file. I restarted the HBase cluster from the time the files were updated, but it still does not use the configuration files that I updated.

The cluster that I use is 2 nodes, one of which is the master. Configuration files on both nodes define the IP of the host node as a zookeeper quorum. I believe that the problem is that my settings specified in hbase-site.xml are not used, because the code works fine if I set the zookeeper quorum to the same value as on my hbase-site.xml via code , but the second node cannot contact the master if the quorum is not specified through code.

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

I am very grateful for the instructions or the link on how to include hbase-site.xml in my path to the code class. I am developing Eclipse on a Windows computer and installing the HBase environment on a Linux cluster. I usually use Eclipse to compile code due to dependencies.

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

Thanks in advance!

+4
source share
1 answer

If it uses the default value, regardless of what you put in your hbase-site.xml , this probably means that it is being overridden by another file in your class path. This is very possible, because the hbase bank already has conf-site.xml .

To fix this, edit your class path to add the directory containing your hbase-site.xml at the end of the class path to make sure nothing overrides it. Sort of:

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

If it becomes too obscure, I would advise you to run it from the command line, and not in Eclipse, so that you can be sure that you have in your classpath.

Hope this helps.

+7
source

All Articles