我尝试过hdfs和pyhdfs库操作hdfs,不过两种方式都是在操作upload时报错,在网上找不到答案,希望有大神可以指点一下。
搭hdfs的同事告诉我,操作是用9000的端口,不过不知道为什么9000端口报404,操作50070没问题,可以新建文件夹,查看目录。
>>> from hdfs import *
>>> client = Client("http://192.168.xx.xxx:50070")
>>> client.list("/")
[u'tmp', u'user']
>>> client.upload("/tmp/kenvs", "/home/test.txt")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu1604/.local/lib/python2.7/site-packages/hdfs/client.py", line 605, in upload
raise err
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f48193a2690>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution