今天晚上,我们有一个磁盘空间已满的问题,今天我在Flume日志中收到此错误:
22 Feb 2017 10:24:56,180 ERROR [pool-6-thread-1] (org.apache.flume.client.avro.ReliableSpoolingFileEventReader.openFile:504) - Exception opening file: /.../flume_spool/data.../data_2017-02-21_17-15-00_8189
java.io.IOException: Not a data file.
at org.apache.avro.file.DataFileStream.initialize(DataFileStream.java:102)
at org.apache.avro.file.DataFileReader.<init>(DataFileReader.java:97)
at org.apache.avro.file.DataFileWriter.appendTo(DataFileWriter.java:160)
at org.apache.avro.file.DataFileWriter.appendTo(DataFileWriter.java:149)
at org.apache.flume.serialization.DurablePositionTracker.<init>(DurablePositionTracker.java:141)
at org.apache.flume.serialization.DurablePositionTracker.getInstance(DurablePositionTracker.java:76)
at org.apache.flume.client.avro.ReliableSpoolingFileEventReader.openFile(ReliableSpoolingFileEventReader.java:478)
at org.apache.flume.client.avro.ReliableSpoolingFileEventReader.getNextFile(ReliableSpoolingFileEventReader.java:459)
at org.apache.flume.client.avro.ReliableSpoolingFileEventReader.readEvents(ReliableSpoolingFileEventReader.java:229)
at org.apache.flume.source.SpoolDirectorySource$SpoolDirectoryRunnable.run(SpoolDirectorySource.java:227)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
水槽版本:1.5.2
最佳答案
java.io.IOException: Not a data file
异常是由于存在一个临时目录,其中包含用于处理的元数据。
该目录由flume.conf中spooldir源的定义中的trackerDir指令控制(默认情况下,spooldir中的.flumespool)。
我们最终得到了空的元数据文件,该文件没有avro(我们正在使用avro接收器)预期的2个字节。实际上,仅使用元数据文件,实际数据文件完全没有错。
因此,解决方案是删除.flumespool,问题得以解决(当然,从磁盘释放了一些空间之后)。
/.../flume_spool/data...
find . -type f -empty
.flumespool/.flumespool-main.meta
rm .flumespool/.flumespool-main.meta
Source