用flume监听本地文件运行就马上退出监听了

用flume监听本地文件运行就马上退出监听了

操作系统:Centos 7
Hadoop版本:3.3.0
JDK版本:1.8.0_241
Flume版本:1.10.1

代码情况:

a1.sources = r1
a1.sinks = k1

a1.channels = c1

a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /export/data/data.log
a1.sources.r1.shell = /bin/sh -C

a1.sinks.k1.type = logger

a1.channels.c1.type = memory
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

运行结果及报错内容

17 Oct 2022 12:53:10,053 INFO [main] (org.apache.flume.node.Application.startAllComponents:214) - Starting Channel c1
17 Oct 2022 12:53:10,059 INFO [main] (org.apache.flume.node.Application.startAllComponents:229) - Waiting for channel: c1 to start. Sleeping for 500 ms
17 Oct 2022 12:53:10,060 INFO [lifecycleSupervisor-1-0] (org.apache.flume.instrumentation.MonitoredCounterGroup.register:119) - Monitored counter group for type: CHANNEL, name: c1: Successfully registered new MBean.
17 Oct 2022 12:53:10,061 INFO [lifecycleSupervisor-1-0] (org.apache.flume.instrumentation.MonitoredCounterGroup.start:95) - Component type: CHANNEL, name: c1 started
17 Oct 2022 12:53:10,559 INFO [main] (org.apache.flume.node.Application.startAllComponents:241) - Starting Sink k1
17 Oct 2022 12:53:10,560 INFO [main] (org.apache.flume.node.Application.startAllComponents:252) - Starting Source r1
17 Oct 2022 12:53:10,562 INFO [lifecycleSupervisor-1-1] (org.apache.flume.source.ExecSource.start:170) - Exec source starting with command: tail -F /export/data/data.log
17 Oct 2022 12:53:10,563 INFO [lifecycleSupervisor-1-1] (org.apache.flume.instrumentation.MonitoredCounterGroup.register:119) - Monitored counter group for type: SOURCE, name: r1: Successfully registered new MBean.
17 Oct 2022 12:53:10,563 INFO [lifecycleSupervisor-1-1] (org.apache.flume.instrumentation.MonitoredCounterGroup.start:95) - Component type: SOURCE, name: r1 started

(这一行 ↓ )
17 Oct 2022 12:53:10,580 INFO [pool-3-thread-1] (org.apache.flume.source.ExecSource$ExecRunnable.run:379) - Command [tail -F /export/data/data.log] exited with 127

我不理解

检查一下flume的用户是不是在那个目录中有权限运行tail -f,或者把文件权限改一下试试