设为首页 加入收藏

TOP

初阶Flume之Flume读取文件传入kafka
2019-05-09 02:09:06 】 浏览:57
Tags:初阶 Flume 读取 文件 传入 kafka
版权声明:创作不易,请勿抄袭,转载请注明出处。如有疑问,请加微信 wx15151889890,谢谢。 https://blog.csdn.net/wx740851326/article/details/82699705

二话不说,上配置文件

exec-memory-avro.conf

exec-memory-avro.sources = exec-source
exec-memory-avro.sinks = avro-sink
exec-memory-avro.channels = memory-channel


exec-memory-avro.sources.exec-source.type = exec
exec-memory-avro.sources.exec-source.command = tail -F /home/bigdata/data/date.log
exec-memory-avro.sources.exec-source.shell = /bin/sh -c


exec-memory-avro.sinks.avro-sink.type = avro
exec-memory-avro.sinks.avro-sink.hostname = wxincentos3
exec-memory-avro.sinks.avro-sink.port = 44444


exec-memory-avro.channels.memory-channel.type = memory


exec-memory-avro.sources.exec-source.channels = memory-channel
exec-memory-avro.sinks.avro-sink.channel = memory-channel

这个是用shell命令行来读取文件

写完配置文件就可以启动这个agent了

flume-ng agent -c . -f /root/wangxin/flume/exec-memory-avro.conf -n exec-memory-avro -Dflume.root.logger=INFO,console &

exec-memory-avro就是要配置文件里的agent服务器名称

avro.conf

avro-memory-kafka.sources = avro-source
avro-memory-kafka.sinks = kafka-sink
avro-memory-kafka.channels = memory-channel


avro-memory-kafka.sources.avro-source.type = avro
avro-memory-kafka.sources.avro-source.bind = wxincentos3
avro-memory-kafka.sources.avro-source.port = 44444


avro-memory-kafka.sinks.kafka-sink.type = org.apache.flume.sink.kafka.KafkaSink
avro-memory-kafka.sinks.kafka-sink.brokerList = wxincentos3:9092
avro-memory-kafka.sinks.kafka-sink.topic = test
avro-memory-kafka.sinks.kafka-sink.batchSize = 5
avro-memory-kafka.sinks.kafka-sink.requiredAcks =1


avro-memory-kafka.channels.memory-channel.type = memory


avro-memory-kafka.sources.avro-source.channels = memory-channel
avro-memory-kafka.sinks.kafka-sink.channel = memory-channel

这个配置文件是将读取到的数据传入到kafka 的

flume-ng agent -c . -f /root/wangxin/flume/avro.conf -n avro-memory-kafka -Dflume.root.logger=INFO,console &
两个agent 启动完成之后kafka里的topic就接收到数据了。

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇flume读取日志数据写入kafka &nbs.. 下一篇Flume 自定义source   -- S..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目