更新时间:2022-07-19 GMT+08:00
分享

创建Configuration

功能介绍

HBase通过加载配置文件来获取配置项,包括用户登录信息配置项。

代码样例

下面代码片段在com.huawei.bigdata.hbase.examples包中。

调用类TestMain下的init()方法会初始化Configuration对象:

    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");

    }
分享:

    相关文档

    相关产品