Java訪問帶有Kerberos認證的HBase

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" );
相關文章
相關標籤/搜索