不多说,直接上干货!
一切来源于官网
http://kafka.apache.org/documentation/
Step 4: Send some messages
Step 4: 发送消息
Kafka comes with a command line client that will take input from a file or from standard input and send it out as messages to the Kafka cluster. By default, each line will be sent as a separate message.
Kafka提供了一个命令行的工具,可以从输入文件或者命令行中读取消息并发送给Kafka集群。每一行是一条消息。
Run the producer and then type a few messages into the console to send to the server.
运行producer(生产者),然后在控制台输入几条消息到服务器。
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test This is a message This is another message