2013-12-23 34 views
0
I am doing as below 
FileSystem fs = FileSystem.get(new URI("hdfs://IP:PORT"), context.getConfiguration()); 

      path = new Path("/AAP"); 
      fsOutStream = fs.create(path); 
      // read this file into InputStream 
      inputStream = new ByteArrayInputStream(value.getBytes()); 

      IOUtils.copyBytes(inputStream, fsOutStream, context.getConfiguration()); //After this step a new folder AAP is available on HDFS 

      //Problem in below step 
      fs.copyToLocalFile(path, new Path("/xyz")); //After this step i am expecting that a folder local to DataNode with name "xyz" should be available but its not 

注:我只有一個數據節點和MapRed運行成功copyToLocal不將文件複製到本地數據管理部

可能有人請建議作爲可能是什麼問題?

+0

您看不到錯誤嗎?你是否指定了目標本地文件的絕對路徑? –

+0

這將有助於看到您的實際新路徑() –

+0

xyz尚未在本地DataNode機器上存在,我只是隨機選擇,只是爲了檢查複製部分功能,然後我試圖通過命令find/-type d -iname 'xyz',但是不存在這樣的目錄 –

回答

0

需要檢查的事項:

您有權寫入根目錄嗎?

嘗試使用完整的網址:fs.copyToLocalFile(path, new Path("file:///home/hadoop/xyz"));

+0

感謝您現在的工作 –

相關問題