我試圖從HDFS獲得一些最終結果文件到S3。我想使用DistCp,但它只複製整個文件夾,我只想複製文件夾中的某些文件。如何從HDFS獲取文件到S3
所以我想我需要將我想要的文件移動到他們自己的文件夾,然後用DistCp上傳文件夾。我知道我應該使用FileSystem.rename(path1,path2)
來做到這一點。
所以我從Java嘗試1文件中,這個小測試:
Path itemsTable = new Path("hdfs://localhost/process-changes/itemstable-*");
itemsTable.getFileSystem(getConf()).mkdirs(new Path("hdfs://localhost/output"));
//Simple test moving just 1 file around HDFS via java API
boolean success = itemsTable.getFileSystem(getConf()).rename(new Path("hdfs://localhost/process-changes/itemtable-r-00001"), new Path("hdfs://localhost/output/itemtable-r-00001"));
但我總是得到錯誤從重命名(...)方法了。
這甚至是正確的方法嗎?如果是這樣,任何猜測我做錯了什麼?