我得到了这个例外。我的是带有java 8的HDP 2.5

时间:2017-02-27 19:54:18

标签: hadoop kerberos

我将以下代码保存在静态块中,因为我在很多地方都引用了这段代码。我得到了这个例外。我的是带有java 8的HDP 2.5。

public static FileSystem getHdfsFileSystem(Path path, String nameNode, String principal, String keytabLocation){        
    FileSystem fs = null;       
    Configuration configuration = new Configuration();
    configuration.set("fs.hdfs.impl", org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
    configuration.set("fs.file.impl", org.apache.hadoop.fs.LocalFileSystem.class.getName());        

    configuration.set("fs.defaultFS", nameNode);        
    configuration.set("hadoop.security.authentication", "kerberos");
    configuration.set("java.security.krb5.conf","/etc/krb5.conf");
    configuration.set("dfs.namenode.kerberos.principal", "nn/_HOST@SOMECOMPANY.LOCAL"); 
    try {
        UserGroupInformation.setConfiguration(configuration);       
        UserGroupInformation.loginUserFromKeytab(principal, keytabLocation);        
        fs = FileSystem.get(path.toUri(), configuration);                   
    } catch (Exception e) {
        e.printStackTrace();            
    }       
    return fs;
}


But i am getting the below error. I guess my ticket is not getting renewed ?
Please let me know how to renew my ticket ?

java.io.IOException: Can't get Master Kerberos principal for use as renewer
at org.apache.hadoop.mapreduce.security.TokenCache.obtainTokensForNamenodesInternal(TokenCache.java:133)
at org.apache.hadoop.mapreduce.security.TokenCache.obtainTokensForNamenodesInternal(TokenCache.java:100)
at org.apache.hadoop.mapreduce.security.TokenCache.obtainTokensForNamenodes(TokenCache.java:80)
at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:142)
at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:266)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:139)    

0 个答案:

没有答案