Java访问带有Kerberos认证的HBase

2019-03-05 16:27:51 浏览数 (1)

代码语言:javascript复制
conf = HBaseConfiguration.create();
conf.set("hadoop.security.authentication" , "kerberos" );
conf.set("hbase.security.authentication","kerberos");

conf.set("hbase.master.keytab.file", "/hbase.keytab");
conf.set("hbase.master.kerberos.principal",HBASE_MASTER_PRINCIPAL);

conf.set("hbase.regionserver.keytab.file","/hbase.keytab");
conf.set("hbase.regionserver.kerberos.principal",HBASE_RS_PRINCIPAL);

conf.set("hbase.zookeeper.quorum","xxx.xxx.xxx.xxx");
conf.set("hbase.zookeeper.property.clientPort","2181");

---
// 这个hbase.keytab也是从远程服务器上copy下来的, 里面存储的是密码相关信息
// 这样我们就不需要交互式输入密码了
conf.set("keytab.file" , "C:/Users/Downloads/hbase.keytab" );
// 这个可以理解成用户名信息,也就是Principal
conf.set("kerberos.principal" , "hbase/1722.myip.domain@HADOOP.COM" );    

0 人点赞