flume输出到kafka配置

[root@server-21 apache-flume-1.6.0-bin]# cat kafka_test.properties 

# 01-flume-netcat-test
# agent name: a1
# source: netcat
# channel: memory
# sink: logger, local console

# 01 define source,channel,sink name
a1.sources = r1
a1.channels = c1
a1.sinks = k1

# 02 define source
a1.sources.r1.type = exec
a1.sources.r1.command=tail -f /root/log/test.log

# 03 define sink
a1.sinks.k1.type = logger     
a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.topic = ws
a1.sinks.k1.brokerList = server-21:9092,server-22:9092
a1.sinks.k1.requiredAcks = 1  
a1.sinks.k1.batchSize = 20 


# 04 define channel
a1.channels.c1.type = memory
# number of events in memory queue 内存队列中的最大event数值
a1.channels.c1.capacity = 1000 
# number of events for 1 commit(每次向memory queuet放入event,取出event的最大值),所以肯定是比内存队列中的event小
a1.channels.c1.transactioncapacity = 100

# 05 bind source,sink to channel
a1.sources.r1.channels = c1
 # 1个source可以有多个channel
a1.sinks.k1.channel = c1     
 # 1个sink只能从1个channel取数据

你可能感兴趣的:(kafka,flume)