1)配置flume(flume-kafka.conf)
在/opt/setup/flume-1.8/(Flume的安装目录)下创建jobs文件夹,创建conf文件vim flume-kafka.conf
,添加内容:
#define
a1.sources = r1
a1.sinks = k1
a1.channels = c1
#source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F -c +0 /opt/setup/flume-1.8/datas/flume.log
a1.sources.r1.shell = /bin/bash -c
#sink
a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.kafka.bootstrap.servers = node1:9092,node2:9092,node3:9092
a1.sinks.k1.kafka.topic = kafka-flumeTest
a1.sinks.k1.kafka.flumeBatchSize = 20
a1.sinks.k1.kafka.producer.acks = 1
a1.sinks.k1.kafka.producer.linger.ms = 1
#channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
#bind
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
2)创建测试文件/opt/setup/flume-1.8/datas/flume.log</