import org.apache.hadoop.security.UserGroupInformation;
//Kerberos认证
if(hdfsProperties.isKerberosEnable()) {
System.setProperty("java.security.krb5.conf", hdfsProperties.getKrb5());
UserGroupInformation.setConfiguration(configuration);
UserGroupInformation.loginUserFromKeytab(hdfsProperties.getPrincipal(), hdfsProperties.getKeytab());
}
命令:
kinit -kt /home/hdfs.keytab hdfs