我正在尝试从windows10使用pythonjupyter工具连接到ubuntu的vm中的hdfs。有人能帮我解决下面的连接错误吗。谢谢您。
使用的软件包:pywebhdfs ubuntu 18.0.4 windows 10
'''
from pywebhdfs.webhdfs import PyWebHdfsClient
from pprint import pprint
HDFS_CONNECTION = PyWebHdfsClient(host='localhost',port='9000', user_name='root-sai')
HDFS_CONNECTION.list_dir('hdfs"//localhost:9000/New')
''' error:-
ConnectionError: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /webhdfs/v1/hdfs%22//localhost%3A9000/New?op=LISTSTATUS&user.name=root-sai (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000250AB1FF438>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
1条答案
按热度按时间k4emjkb11#
webhdfs端口与rpc端口不同。默认情况下,它是
50070
.如果未启用webhdfs(默认情况下,这是启用的),请在中添加此属性
hdfs-site.xml
```dfs.webhdfs.enabled
true
curl -i "http://localhost:50070/webhdfs/v1/tmp?user.name=hadoop-user&op=GETFILESTATUS"
HDFS_CONNECTION = PyWebHdfsClient(host='localhost',port='50070', user_name='root-sai')
HDFS_CONNECTION.list_dir('/New')