1
我想放置在分佈式緩存中的文件。爲了做到這一點,我調用使用-files選項我的驅動程序類,是這樣的:DistributedCache Hadoop - FileNotFound
hadoop jar job.jar my.driver.class -files MYFILE input output
的getCacheFiles()
和getLocalCacheFiles()
返回包含MYFILE的URI /路徑的陣列。 (如:HDFS://localhost/tmp/hadoopuser/mapred/staging/knappy/.staging/job_201208262359_0005/files/histfile#histfile)
不幸的是,試圖在地圖中的任務檢索MYFILE時,它拋出一個FileNotFoundException
。
我試圖在獨立(本地)模式以及僞分佈模式。
你知道可能是什麼原因嗎?
UPDATE:
以下三行:
System.out.println("cache files:"+ctx.getConfiguration().get("mapred.cache.files"));
uris = DistributedCache.getLocalCacheFiles(ctx.getConfiguration());
for(Path uri: uris){
System.out.println(uri.toString());
System.out.println(uri.getName());
if(uri.getName().contains(Constants.PATH_TO_HISTFILE)){
histfileName = uri.getName();
}
}
打印出這一點:
cache files:file:/home/knappy/histfile#histfile
/tmp/hadoop-knappy/mapred/local/archive/-7231_-1351_105/file/home/knappy/histfile
histfile
因此,該文件似乎在job.xml mapred.cache.files
物業上市並且本地文件似乎存在。不過,拋出FileNotFoundException。
請問您可以看看更新嗎?它仍然沒有找到文件 – Razvan
如何從URI /路徑獲取文件? –
是的,我解決了這個問題。我試圖使用使用該uri實例化的FS實例從uri中獲取它。我應該嘗試在本地獲得,我最終做到了,現在它運作良好。謝謝! – Razvan