How Java reads the contents of the Hbase-site.xml

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.