2022-09-08 15:59:07,297 ERROR flume.SinkRunner (SinkRunner.java:run(158)) - Unable to deliver event. Exception follows. org.apache.flume.EventDeliveryException: org.apache.flume.FlumeException: Error while trying to hflushOrSync! at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:464) at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:67) at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:145) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.flume.FlumeException: Error while trying to hflushOrSync! at org.apache.flume.sink.hdfs.AbstractHDFSWriter.hflushOrSync(AbstractHDFSWriter.java:274) at org.apache.flume.sink.hdfs.HDFSDataStream.sync(HDFSDataStream.java:126) at org.apache.flume.sink.hdfs.BucketWriter$5.call(BucketWriter.java:520) at org.apache.flume.sink.hdfs.BucketWriter$5.call(BucketWriter.java:517) at org.apache.flume.sink.hdfs.BucketWriter$8$1.run(BucketWriter.java:727) at org.apache.flume.auth.SimpleAuthenticator.execute(SimpleAuthenticator.java:50) at org.apache.flume.sink.hdfs.BucketWriter$8.call(BucketWriter.java:724) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.flume.sink.hdfs.AbstractHDFSWriter.hflushOrSync(AbstractHDFSWriter.java:266) ... 10 more
了解了一下集群的部署模式,发现是因为每一个节点都安装了Flume Agent,这个才是真正的问题所在,一旦开启多个Flume Agent使用相同的配置的时候,会出现同名的文件被不同的flume agent打开,在文件第二次打开后,先前打开的agent拥有的token就失效了,因此无法关闭它,就会不断的报错:Error while trying to hflushOrSync!