标签:and bash gen 创建 trap command sum res console
kafkaflume.confagent.sources = s1
agent.channels = c1
agent.sinks = k1
agent.sources.s1.type=exec
agent.sources.s1.command=tail -F /usr/local/src/flume/testflume2.log
agent.sources.s1.channels=c1
agent.channels.c1.type=memory
agent.channels.c1.capacity=10000
agent.channels.c1.transactionCapacity=100
#设置Kafka接收器
#
agent.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
##设置Kafka的broker地址和端口号
agent.sinks.k1.kafka.bootstrap.servers = master:9092,node01:9092,node02:9092
##设置Kafka的Topic
agent.sinks.k1.kafka.topic = mydemo5
##设置序列化方式
#
#
agent.sinks.k1.kafka.flumeBatchSize = 20
agent.sinks.k1.kafka.producer.acks = 1
agent.sinks.k1.kafka.producer.linger.ms = 1
agent.sinks.ki.kafka.producer.compression.type = snappy
agent.sinks.k1.channel=c1
创建一个topic
kafka-topics --create --zookeeper master:2181/kafka --replication-factor 2 --partitions 3 --topic mydemo5
启动flume作为消息生产者写道kafka上
flume-ng agent -c conf -f kafkaflume.conf -n agent -Dflume.root.logger=INFO,console
消费kafka的数据
kafka-console-consumer --bootstrap-server master:9092 --topic mydemo5 --from-beginning
读取一个文件的内容写入追加到新的文件
#!/bin/bash
while read line
do
echo $line
sleep 0.01
echo -e $line >> /usr/local/src/flume/testflume2.log
done < /etc/sudo-ldap.conf
标签:and bash gen 创建 trap command sum res console
原文地址:https://blog.51cto.com/12473494/2420857