How Java reads the contents of the Hbase-site.xml
The configuration information used by the Java client is mapped to a hbaseconfiguration instance.
Hbaseconfiguration has a factory method, Hbaseconfiguration.create ();
When you run this method, he will go to classpath, look for hbase-site.xml, and read the contents of the first configuration file he found.
(This method will also find Hbase-default.xml; hbase.) X.x.x.jar There will also be an hbase-default.xml).
It is also possible to inject configuration information directly from Java code without any hbase-site.xml files. For example, you can set zookeeper information programmatically, as long as you do this:
Configuration config = HBaseConfiguration.create();config.set("hbase.zookeeper.quorum", "localhost"); // Here we are running zookeeper locally
If you have multiple zookeeper instances, you can use a comma list. (Just like you did in the Hbase-site.xml file). This instance of the Configuration is passed to the instance of Htable, and so on.
How Java reads the contents of the Hbase-site.xml