java-无法指定服务器的kerberos主体名称

bq9c1y66  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(352)

我有一些使用hdfs和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("user@...", "/Users/user/user.keytab");

你认为问题出在哪里?在我的主机(10.0.3.33)上,core-site.xml和hdfs-site.xml配置正确。但我不是从那个主机上跑出来的,这是个例外。
为了能够在任何主机上运行测试,您知道该怎么做吗?
谢谢,塞尔维亚人

xxls0lw8

xxls0lw81#

如果您使用的是低于2.6.2的hadoop旧版本,那么hdfs-site.xml文件中没有默认模式属性,那么您需要手动指定模式属性。

config.set("dfs.namenode.kerberos.principal.pattern", "hdfs/*@BDBIZVIZ.COM");

相关问题