java连接Hbase+Kerberos配置参数示例

配置参数示例代码:


private static void init() throws IOException {
    // Default load from conf directory
    conf = HBaseConfiguration.create();
   /* String userdir = System.getProperty("user.dir") + File.separator + "conf" + File.separator;
    conf.addResource(new Path(userdir + "core-site.xml"));
    conf.addResource(new Path(userdir + "hdfs-site.xml"));
    conf.addResource(new Path(userdir + "hbase-site.xml"));*/
    conf.set("hbase.zookeeper.quorum", "c2bde02,c2bde03,c2bde55");
    conf.set("hbase.zookeeper.property.clientPort", "2181");
    conf.set("zookeeper.znode.parent", "/hbase-secure");
    conf.set("hbase.security.authentication", "kerberos");
    conf.set("hadoop.security.authentication" , "Kerberos" );
    conf.set("hbase.master.kerberos.principal", "hbase/[email protected]");
    conf.set("hbase.regionserver.kerberos.principal", "hbase/[email protected]");
  }

如果未加载hbase-site.xml文件,需要设置hbase.master.kerberos.principal和hbase.regionserver.kerberos.principal两个参数

你可能感兴趣的:(HBase)