- 先停掉 node1 和 node3 上的 flume
- 将 node1 上的 option 拷贝 option_exec,并修改:
[root@node1 ~]# cp option option_exec
[root@node1 ~]# vim option_exec
# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /root/log.txt
# Describe the sink
- 启动 node1 上的 flume
[root@node1 ~]# flume-ng agent -n a1 --conf-file option_exec -Dflume.root.logger.INFO,console
- 复制一个 node1 连接的 xshell 终端
[root@node1 ~]# echo "hello neusoft" >> log.txt
[root@node1 ~]# echo "hello yqq" >> log.txt
- 然后在启动 flume 的终端中查看信息
21/11/20 14:09:58 INFO source.ExecSource: Exec source starting with command:tail -F /root/log.txt
21/11/20 14:09:58 INFO instrumentation.MonitoredCounterGroup: Monitored counter group for type: SOURCE, name: r1: Successfully registered new MBean.
21/11/20 14:09:58 INFO instrumentation.MonitoredCounterGroup: Component type: SOURCE, name: r1 started
21/11/20 14:13:24 INFO sink.LoggerSink: Event: { headers:{} body: 68 65 6C 6C 6F 20 6E 65 75 73 6F 66 74 hello neusoft }
21/11/20 14:14:03 INFO sink.LoggerSink: Event: { headers:{} body: 68 65 6C 6C 6F 20 79 71 71 hello yqq }