参考:https://blog.youkuaiyun.com/fuck487/article/details/80859581
上传文件时报错:
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):socket.gaierror: [Errno 11001] getaddrinfo failed
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000023E517495C8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
需要把本地的hosts改下,添加hadoop集群的IP映射
linux下修改/etc/hosts,win下修改C:\Windows\System32\drivers\etc\hosts
这是我的集群
# /etc/hosts
192.168.6.47 master
192.168.6.41 slave1
192.168.6.48 slave2
出现的原因:
会建立2次socket连接,第一次连接成功,第二次连接失败。第二次失败是找不到主机名对应的IP。上传时业务由另一个主机来完成。本地会和另一个主机建立连接,只知道另一个主机的主机名,查看本地的hosts文件,找不到IP映射。
详情如下:
client=Client(url = "http://192.168.6.47:50070/&