bin/kafka-console-producer.sh--broker-list localhost:9092--topic test >Hello, World! > “Hello World!”为写入的数据。
查看刚刚写入的数据 另外开一个ssh tab连接,然后执行如下命令
1 2 3 4
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning Using the ConsoleConsumer withold consumer is deprecated and will be removed in a future major release. Consider using the new consumer bypassing [bootstrap-server] insteadof [zookeeper].