合并hdfs小文件

如果需要合并HDFS上的某个temp目录下有很多小文件(1.txt,2.txt),可以尝试使用下面的命令:

   hadoop fs -cat  hdfs://cdh5/tmp/*.txt | hadoop fs -appendToFile - hdfs://cdh5/tmp/hdfs_largefile.txt

注意:这种处理方法在数据量非常大的情况下可能不太适合,最好使用MapReduce来合并。

猜你喜欢

转载自blog.csdn.net/someInNeed/article/details/110039205