加载到hadoop mr之前的文件验证

mec1mxoz  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(644)

我有一个文件夹的输入bz2文件,其中一些可能已损坏,我想删除所有损坏/无效的bz2文件,然后再运行我的mr作业。有什么好办法?

wbgh16ku

wbgh16ku1#

使用bzip2-t测试bzip文件是否损坏。如果它坏了,我想你可以看到这样的东西。

bzip2: test1.txt: bad magic number (file not created by bzip2)
bzip2: 2: bad magic number (file not created by bzip2)

You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.

因此,如果您的文件在本地文件系统中,那么基于上述要点使用一些shell脚本应该是可行的。如果您的文件已经在hdfs上,那么使用hadoop streaming with mapper作为脚本输出损坏的文件,而不使用reducer,或者使用reducer删除或后处理这些文件。

相关问题