0
想知道是否有方法來識別添加到HDFS路徑中的新文件?例如,如果某些文件已經存在一段時間了。現在我今天添加了新文件。所以只想處理這些新文件。什麼是實現這一目標的最佳方式。如何識別HDFS中的新文件
謝謝
想知道是否有方法來識別添加到HDFS路徑中的新文件?例如,如果某些文件已經存在一段時間了。現在我今天添加了新文件。所以只想處理這些新文件。什麼是實現這一目標的最佳方式。如何識別HDFS中的新文件
謝謝
您需要編寫一個java代碼來執行此操作。這些步驟可能有所幫助:
1. Before adding new files, fetch the last modified time (hadoop fs -ls /your-path). Lets say it as mTime.
2. Next upload new files into hdfs path
3. Now filter the files that are greater than mTime. These files are to be processed. Make your program to process only these files.
這只是開發代碼的提示。 :)
如果是Mapreduce,那麼您可以創建每天附加時間戳的輸出目錄。
像
FileOutputFormat.setOutputPath(job, new Path(hdfsFilePath
+ timestamp_start); // start at 12 midnight for example: 1427241600 (GMT) --you can write logic to get epoch time
進一步信息:有將是唯一一個接收每天的基礎上,即子文件夾不能在主要的一個創建的文件夾。只有文件級別的信息必須用於瞭解文件是否被處理 – 2015-03-25 12:49:08