无法获取 Kerberos 领域

2024-01-24

我是 Kerberos/hive 的新手,想要使用 JDBC 连接 hive(Kerberos 实现)。

> > org.apache.hadoop.conf.Configuration conf = new
> > org.apache.hadoop.conf.Configuration();
> >             conf.set("hadoop.security.authentication", "Kerberos");
> >             UserGroupInformation.setConfiguration(conf);
> >             UserGroupInformation.loginUserFromKeytab("<principal>", "<path to keytab file>");
> > 
> > 
> > Class.forName(Util.getConstantProperty("hive.class.name"));
> > 
> > log.info("Making connection with Hive DB"); hiveConn =
> > DriverManager.getConnection("<hive db url>",,"hive.user","");

出现错误:

2018-10-29 20:32:50 ERROR ConnectionHandler:80 - java.lang.IllegalArgumentException: Can't get Kerberos realm java.lang.IllegalArgumentException: Can't get Kerberos realm
        at org.apache.hadoop.security.HadoopKerberosName.setConfiguration(HadoopKerberosName.java:65)
        at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:263)
        at org.apache.hadoop.security.UserGroupInformation.setConfiguration(UserGroupInformation.java:299)
        at utils.ConnectionHandler.connectHiveDB(ConnectionHandler.java:58)

另外评论中Prazy的建议

不要忘记在 krb5.conf 中设置默认领域

如果仍然有问题,请将 kerberos 调试添加到命令行中

export HADOOP_OPTS="-Dsun.security.krb5.debug=true"
export HADOOP_ROOT_LOGGER=DEBUG,console
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法获取 Kerberos 领域 的相关文章

随机推荐