python-hdfs使用记录hdfs访问User: dr.who is not allowed to impersonate hdfs

使用python的hdfs包操作错误解决

在使用的时候会出现错误
User: dr.who is not allowed to impersonate hdfs

client=Client("http://namenode:50070/",proxy='hdfs')

解决有两种:
1.修改hdfs配置
hadoop.proxyuser.dr.who.hosts = *
hadoop.proxyuser.dr.who.user = *
hadoop.proxyuser.dr.who.group = *
生效配置(如果有HA的需要在全部HA节点执行)

hdfs dfsadmin –refreshSuperUserGroupsConfiguration
yarn rmadmin –refreshSuperUserGroupsConfiguration

修改使用方法

client=Client("http://namenode:50070/",proxy='hdfs')

改为

client=InsecureClient("http://namenode:50070/",user='hdfs')

参考:https://hdfscli.readthedocs.io/en/latest/quickstart.html


版权声明:本文为u010025966原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。