配置文件: vim dir-hdfs.conf
a1.sources = r1
a1.sinks = k1
a1.channels = c1
#对于source的配置描述 监听文件中的新增数据 exec
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /opt/log/access.log //采集数据的路径
a1.sources.ri.shell = /bin/sh -c
#对于sink的配置描述 使用kafka做数据的消费
a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.topic = kk8 //采集到哪里
a1.sinks.k1.brokerList = 192.168.88.11:9092,192.168.88.12:9092,192.168.88.13:9092
a1.sinks.k1.requiredAcks = 1
a1.sinks.k1.batchSize = 5
#对于channel的配置描述 使用内存缓冲区域做数据的临时缓存
a1.channels.c1.type = memory
#通过channel c1将source r1和sink k1关联起来
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
启动flume
./flume-ng agent -c /usr/local/flume/conf -f /usr/local/flume/conf/dir-hdfs.conf -n a1 -Dflume.root.logger=INFO,console