我正在尝试集成flume和kafka,其中flume获取一个数据文件并推送到kafka,然后再推送到spark。
我在博客上看到了这个配置文件,名为flafka.conf:
tier1.sources = source1
tier1.channels = channel1
tier1.sinks = sink1
tier1.sources.source1.type = exec
tier1.sources.source1.command = /Users/name1/test.txt
tier1.sources.source1.channels = channel1
tier1.channels.channel1.type = memory
tier1.channels.channel1.capacity = 10000
tier1.channels.channel1.transactionCapacity = 1000
tier1.sinks.sink1.type = org.apache.flume.sink.kafka.KafkaSink
tier1.sinks.sink1.topic = sink1
tier1.sinks.sink1.brokerList = kafkagames-1:9092,kafkagames-2:9092
tier1.sinks.sink1.channel = channel1
tier1.sinks.sink1.batchSize = 20
然后我运行这个命令:
bin/flume-ng agent --conf conf --conf-file flafka.conf --name a1 -Dflume.root.logger=INFO,console
如何测试是否可以在kafka中看到test.txt文件的内容。请给我建议。谢谢!!!
1条答案
按热度按时间j9per5c41#
您可以尝试kafka console consumer,以检查是否有内容写入了kafka主题。因此,您从flume推送文件并在console consumer中等待在kafka主题中看到它。
Kafka控制台消费者描述可在以下位置找到:https://cwiki.apache.org/confluence/display/kafka/system+tools