我需要采集的数据为访问日志
vi ibike_access.conf
a1.sources = r1
a1.channels = c1
a1.sinks = k1
a1.sources.r1.type = exec
a1.sources.r1.command =tail -F /opt/ibike/log/ibike_access.logss
a1.sources.r1.shell = /bin/sh -c
a1.sources.r1.fileHeader = true
a1.channels.c1.type = org.apache.flume.channel.kafka.KafkaChannel
a1.channels.c1.kafka.bootstrap.servers = node1:9092,node2:9092,node3:9092
a1.channels.c1.kafka.topic = access001
a1.channels.c1.parseAsFlumeEvent= true
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://node1:8020/ibike/ibike_access
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.filePrefix =Text
a1.sinks.k1.hdfs.round = true
a1.sinks.k1.hdfs.roundValue = 10
a1.sinks.k1.hdfs.roundUnit = minute
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
执行文件:flume-ng agent --conf conf --conf-file /opt/flume_config/ibike_access.conf --name a1 -Dflume.root.logger=DEBUG,console
在kafka和hdfs上即可查看: