Flume实时采集日志到Kafka(极简版)

转自:https://www.pianshen.com/article/6868334446/

wget -c https://mirrors.bfsu.edu.cn/apache/flume/1.9.0/apache-flume-1.9.0-bin.tar.gz
tar -zxvf apache-flume-1.9.0-bin.tar.gz 

vi /root/apache-flume-1.9.0-bin/conf/kafka-producer.conf
pro.sources = s1
pro.channels = c1
pro.sinks = k1

pro.sources.s1.type = exec
pro.sources.s1.command = tail -F /root/flumetest.txt

pro.channels.c1.type = memory
pro.channels.c1.capacity = 1000
pro.channels.c1.transactionCapacity = 100

pro.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
pro.sinks.k1.kafka.topic = test
pro.sinks.k1.kafka.bootstrap.servers = 192.168.172.137:9092,192.168.172.138:9092,192.168.172.139:9092
pro.sinks.k1.kafka.flumeBatchSize = 20
pro.sinks.k1.kafka.producer.acks = 1
pro.sinks.k1.kafka.producer.linger.ms = 1
pro.sinks.k1.kafka.producer.compression.type = snappy

pro.sources.s1.channels = c1
pro.sinks.k1.channel = c1


/root/apache-flume-1.9.0-bin/bin/flume-ng agent -n pro -c /root/apache-flume-1.9.0-bin/conf  -f kafka-producer.conf