Creating the Configuration Object
Function Description
HBase obtains configuration items by loading a configuration file, including user login information configuration items.
Sample Code
The following code snippets are in the com.huawei.bigdata.hbase.examples packet.
Invoke the init () method under the TestMain class to initialize the Configuration object.
private static void init() throws IOException {
// load hbase client info
if(clientInfo == null) {
clientInfo = new ClientInfo(CONF_DIR + HBASE_CLIENT_PROPERTIES);
restServerInfo = clientInfo.getRestServerInfo();
}
// Default load from conf directory
conf = HBaseConfiguration.create();
conf.addResource(CONF_DIR + "core-site.xml");
conf.addResource(CONF_DIR + "hdfs-site.xml");
conf.addResource(CONF_DIR + "hbase-site.xml");
} Last Article: Development Guidelines in Typical Scenarios
Next Article: Creating the Connection Object
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.