python2 连接hdfs 解决kerberos认证

首先安装包:

pip2 install hdfs

pip2 install requests_kerberos

然后代码认证

from hdfs.ext.kerberos import KerberosClient
client = KerberosClient('http://xx.xx.xx.xx:50070', hostname_override="bj-gc3-arch-hadoop-namenode-01")  
client.list('/user')

你可能感兴趣的:(python,hadoop,hdfs,python,hadoop)