python访问hdfs

2023年1月3日10:27:29
pip install hdfs

python 读取hdfs目录或文件

import hdfs

client =hdfs.Client("http://10.10.1.4:50070")
fileDir="/user/hive/warehouse/house.db/dm_house/dt=201800909"
try:
    status=client.status(fileDir,False)
    if status:
        print (status)
        rst=client.download(fileDir,"/home/dev/gewei")
        print (rst)
exception Exception as e:
    print (e)

 

  • 作者:gdolphinw
  • 原文链接:https://blog.csdn.net/gdolphinw/article/details/82871452
    更新时间:2023年1月3日10:27:29 ,共 294 字。