前言
HDFS主要用来存储文件系统
安装
pip install hdfs
使用
from hdfs.client import Client
client = Client(HDFSHOST,root="/",timeout=900,session=False) #连接hdfs
参数说明:
classhdfs.Client(url, root=None, proxy=None, timeout=None, session=None)
url:ip:端口
root:制定的hdfs根目录
proxy:制定登陆的用户身份
timeout:设置的超时时间
session:设置节点
with client.read(path) as fs: #读取hdfs