File upload 如何在Kafka Consumer中检查file.txt的输出?

File upload 如何在Kafka Consumer中检查file.txt的输出?,file-upload,apache-kafka,flume-ng,File Upload,Apache Kafka,Flume Ng,我正在尝试将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/co

我正在尝试将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的内容。请给我一些建议。谢谢。

因为Kafka是一个消息代理“服务”,所以在使用Flume生成器生成消息之前,您必须运行它。在制作人生成(放置)一条消息到卡夫卡主题(一种缓冲区)后,您可以使用卡夫卡消费者来消费(获取)该消息

如何启动卡夫卡服务: