How to write a file to Kafka Producer

后端 未结 4 468
甜味超标
甜味超标 2020-12-07 20:57

I am trying to load a simple text file instead of standard input in Kafka. After downloading Kafka, I performed the following steps:

Started zookeeper:

4条回答
  •  不思量自难忘°
    2020-12-07 21:36

    You can pipe it in:

    kafka-console-producer.sh --broker-list localhost:9092 --topic my_topic
    --new-producer < my_file.txt
    

    Found here.

    From 0.9.0:

    kafka-console-producer.sh --broker-list localhost:9092 --topic my_topic < my_file.txt
    

提交回复
热议问题