欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python訪問hdfs的操作

 更新時間:2020年06月06日 10:02:07   作者:gdolphinw  
這篇文章主要介紹了python訪問hdfs的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

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)

補(bǔ)充知識:用python訪問hdfs出現(xiàn)webhdfs找不到的情況

有可能是webhdfs服務(wù)沒有開啟

向hdfs-site.xml文件中添加屬性:

<property> 
  <name>dfs.webhdfs.enabled</name> 
  <value>true</value> 
</property> 

可以使用如下命令檢測,

獲得目錄的列表:

curl -i "http://Hadoop:50070/webhdfs/v1/?user.name=hadoop&op=LISTSTATUS"

以上這篇python訪問hdfs的操作就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論