如何将Java Hadoop认证_hadoop3 Java客户端 Kerberos认证实现为高效安全的认证流程?
- 内容介绍
- 文章标签
- 相关推荐
本文共计190个文字,预计阅读时间需要1分钟。
plaintext使用以下认证方法:Configuration config=new Configuration();
org.apache.hadoophadoop-hdfs3.1.1org.apache.hadoophadoop-common3.1.1org.apache.hadoophadooorg.apache.hadoop
hadoop-hdfs
3.1.1
org.apache.hadoop
hadoop-common
3.1.1
org.apache.hadoop
hadoop-client
3.1.1
认证方法
Configuration config new Configuration();
config.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
config.set("dfs.client.block.write.replace-datanode-on-failure.policy", "NEVER");
//开始Kerberos认证
String krb5File "/etc/krb5.conf";
System.setProperty("java.security.krb5.conf", krb5File);
config.set("hadoop.security.authentication", "kerberos");
UserGroupInformation.setConfiguration(config);
try {
UserGroupInformation.loginUserFromKeytab(kerUser, keyPath);
} catch (IOException e) {
e.printStackTrace();
}
//结束Kerberos认证
URI uri new URI("hdfs://" host ":" port);
FileSystem.get(uri, config);
参考博客blog.csdn.net/weixin_43989001/article/details/86309512
本文共计190个文字,预计阅读时间需要1分钟。
plaintext使用以下认证方法:Configuration config=new Configuration();
org.apache.hadoophadoop-hdfs3.1.1org.apache.hadoophadoop-common3.1.1org.apache.hadoophadooorg.apache.hadoop
hadoop-hdfs
3.1.1
org.apache.hadoop
hadoop-common
3.1.1
org.apache.hadoop
hadoop-client
3.1.1
认证方法
Configuration config new Configuration();
config.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
config.set("dfs.client.block.write.replace-datanode-on-failure.policy", "NEVER");
//开始Kerberos认证
String krb5File "/etc/krb5.conf";
System.setProperty("java.security.krb5.conf", krb5File);
config.set("hadoop.security.authentication", "kerberos");
UserGroupInformation.setConfiguration(config);
try {
UserGroupInformation.loginUserFromKeytab(kerUser, keyPath);
} catch (IOException e) {
e.printStackTrace();
}
//结束Kerberos认证
URI uri new URI("hdfs://" host ":" port);
FileSystem.get(uri, config);
参考博客blog.csdn.net/weixin_43989001/article/details/86309512

