【发布时间】:2015-11-04 06:02:29
【问题描述】:
我正在尝试将 Flume 与 Kafka 集成,我想将文件从本地机器传递到 Flume,然后再传递到 Kafka。我想在 Kafka Consumer 中查看我的文件内容。
这是我在 Flume 中的配置文件:
# example.conf: A single-node Flume configuration
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command = cat /Users/myname/Downloads/file.txt
# Describe the sink
#a1.sinks.k1.type = logger
a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.topic = k1
a1.sinks.k1.brokerList = kafkagames-1:9092,kafkagames-2:9092
a1.sinks.sink1.batchSize = 20
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 10000
a1.channels.c1.transactionCapacity = 10000
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
我不知道如何从 Flume 启动 Kafka 并在 Kafka Consumer 中查看 file.txt 的内容。请指教。谢谢。
【问题讨论】:
标签: file-upload apache-kafka flume-ng