用于 Flume 接收器文件的 Hadoop Streaming MapReduce - FileNotFoundException

标签 hadoop filenotfoundexception flume tmp

我遇到以下异常:

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/

相关文章:

java - 在Java程序中没有处理FileNotFoundException文件吗?

hadoop - 使用 Apache Flume 收集 CPU 时间日志

hadoop - Flume 架构 : Events passing to Channel

由于未知原因引发 java.io.FileNotFoundException

android - 检查 DocumentFile 是否存在

apache - 在 Apache Flume JMS 1.6.0 中配置 SSL

mysql - RDBMS MySQL 中的 sqoop 导出更新表记录

hadoop - 使用Hadoop稳定版为一项工作提供多个输出的最佳方法是什么?

java - Hadoop的NoSuchMethodError

ubuntu - 打开存储在 HDFS 中的文件以在 VI 中进行编辑