当前位置 : 主页 > 网络编程 > 其它编程 >

javahadoop认证_hadoop3Javaclient客户端kerberos认证

来源:互联网 收集:自由互联 发布时间:2023-07-02
org.apache.hadoophadoop-hdfs3.1.1org.apache.hadoophadoop-common3.1.1org.apache.hadoophadoo org.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
org.apache.hadoophadoop-hdfs3.1.1org.apache.hadoophadoop-common3.1.1org.apache.hadoophadoo

05c7dcae9a960c747d5baa6b0c643aa0.png

org.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);

参考博客https://blog.csdn.net/weixin_43989001/article/details/86309512

上一篇:Hadoop中的序列化Writable
下一篇:没有了
网友评论