0
我有一些使用HDFS和Kerberos身份驗證的集成測試。當我運行它們,我得到這個異常:Java - 無法指定服務器的Kerberos主體名稱
java.io.IOException: Failed on local exception: java.io.IOException: java.lang.IllegalArgumentException: Failed to specify server's Kerberos principal name; Host Details : local host is: "Serbans-MacBook-Pro.local/1.2.3.4"; destination host is: "10.0.3.33":8020;
at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:772)
at org.apache.hadoop.ipc.Client.call(Client.java:1472)
at org.apache.hadoop.ipc.Client.call(Client.java:1399)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:232)
at com.sun.proxy.$Proxy12.getFileInfo(Unknown Source)
我相信一切都正確配置:
System.setProperty("java.security.krb5.realm", "...");
System.setProperty("java.security.krb5.kdc", "...");
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://10.0.3.33:8020");
conf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
conf.set("hadoop.security.authentication", "Kerberos");
UserGroupInformation.setConfiguration(conf);
UserGroupInformation.loginUserFromKeytab("[email protected]", "/Users/user/user.keytab");
那你認爲問題是什麼?在我的主機(10.0.3.33)上,我正確配置了core-site.xml和hdfs-site.xml。但我不是從那個主持人那裏跑出來的,就像例外所表明的那樣。
任何想法該怎麼做,爲了能夠從任何主機運行測試?
感謝, 謝爾班
Kerberos是一個安全層......因此它在許多方面都有點偏執。首先,它需要主機名稱,而不是IP。它還運行反向DNS檢查,以便您必須提供* canonical *主機名。最後,如果你的Hadoop主機不在DNS中,或者沒有在規範的DNS名稱下,你必須在你本地的'/ etc/hosts'(或者任何可能在iSOD上的路徑)中填入空格並更新你的Hadoop' *** - site.xml'相應的配置文件。 –