r1.sources = source1
r1.channels = channel1
r1.sinks = sink1
r1.sources.source1.type = netcat
r1.sources.source1.bind = localhost
r1.sources.source1.port = 8888
r1.sources.source1.channels = channel1
r1.channels.channel1.type = memory
r1.sinks.sink1.type = logger
r1.sinks.sink1.channel = channel1
r1.channels.channel1.capacity = 100
需要先配置一个conf文件,此时该文件的名字为agent.conf,然后使用命令开启flume
flume-ng agent --conf conf --conf-file agent.conf --name r1 -Dflume.root.logger=INFO,console
然后使用ncat来监听端口,并发送消息给flume接受
ncat localhost 8888
然后输入信息,那么在flume命令行端口就能收到对应的消息