我遇到以下异常:
java.io.FileNotFoundException: File does not exist: /log1/20131025/2013102509_at1.1382659200021.tmp
at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.fetchLocatedBlocks(DFSClient.java:2006)
at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.openInfo(DFSClient.java:1975)
...
当 MR 作业正在运行时。 Flume 将文件名从 xxx.tmp
更改为 xxx.
并且 MR 任务找不到文件(MR 正在尝试读取 xxx.tmp
)并抛出错误。
我不知道如何避免 FileNotFoundException。
我正在通过 Hadoop 流运行 MR 作业($hadoop jar contrib/streaming/hadoop-streaming-1.2.1.jar...
)
有排除xxx.tmp文件的选项吗?
最佳答案
我有同样的经历,我通过添加到我的水槽配置文件来解决它
hdfs 接收器配置
hdfs.inUsePrefix = .<br/>
hdfs.inUseSuffix = .temp
我使用 "hdfs.inUsePrefix" 值 "." 以便在流式传输时从我的 Hive 查询中隐藏文件。
问题
我注意到在外部表的配置单元上运行“选择查询”时,这些表的位置是文件流式传输到其中的位置,我遇到了这样的错误
java.io.FileNotFoundException: File does not exist: hdfs://hmaster:9000/data/etl/sdp/statistics/ppasinterface/some/path/to/a/partition/some_files.tmp
检查 flume 日志文件显示将 some_file.tmp 重命名为 some.file 是失败的原因。
你可以引用《Using Flume By Hari Shreedharan》一书[Page 177/178 if using epub] 也结账 http://flume.apache.org/FlumeUserGuide.html#hdfs-sink
关于用于 Flume 接收器文件的 Hadoop Streaming MapReduce - FileNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19579668/