问题描述
我想使用pyhdfs
在我的hdfs系统上进行操作。我可以正常获取lstdir
或NameNode
的信息,但是我无法将本地文件放到系统中,出现这样的错误:
ConnectionError:httpconnectionPool(host ='ali',port = 50075):URL超过最大重试次数:/webhdfs/v1/HarryPotter/harry%20potter2.txt?op=CREATE&user.name=root&namenoderpcaddress=ali:9000&overwrite=false (由NewConnectionError(“
:未能建立新连接:[Errno 11001] getaddrinfo失败”引起))
我已经尝试将max_tries
和retry_delay
设置为一个较大的数字,但是还是有问题。这是我的代码(本地文件位于正确的路径):
import pyhdfs
fs = pyhdfs.HdfsClient(hosts='my_ip_here,50070',user_name='root',max_tries=10,retry_delay=2000)
path='/HarryPotter/'
print('Path existed!') if fs.exists(path) else fs.mkdirs(path)
file = 'harry potter2.txt'
print('File existed!') if fs.exists(path+file) else fs.copy_from_local(file,path+file)
感谢帮助:)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)