[wangshumin@centoshostnameKL1 kafka_2.11-0.9.0.1]$ kafka-console-producer.sh --broker-list centoshostnameKL1:9092,centoshostnameKL2:9092,centoshostnameKL3:9092 --topic kafkaTopic
hhhh
jjj
kk
kk
kk
kk
kk
kk
kkl
k
wangshumingggggggggg
^[[A
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[wangshumin@centoshostnameKL3 bin]$ kafka-console-consumer.sh --topic kafkaTopic --zookeeper centoshostnameKL1:2181,centoshostnameKL2:2181,centoshostnameKL3:2181 --from-beginning
jjj
hhhh
kk
kk
kk
kk
kk
kk
kkl
k
^CProcessed a total of 10 messages
[wangshumin@centoshostnameKL3 bin]$ kafka-console-consumer.sh --topic kafkaTopic --zookeeper centoshostnameKL1:2181,centoshostnameKL2:2181,centoshostnameKL3:2181
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hhhh
jjj
kk
kk
kk
kk
kk
kk
kkl
k
wangshumingggggggggg
^[[A
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[wangshumin@centoshostnameKL3 bin]$ kafka-console-consumer.sh --topic kafkaTopic --zookeeper centoshostnameKL1:2181,centoshostnameKL2:2181,centoshostnameKL3:2181 --from-beginning
jjj
hhhh
kk
kk
kk
kk
kk
kk
kkl
k
^CProcessed a total of 10 messages
[wangshumin@centoshostnameKL3 bin]$ kafka-console-consumer.sh --topic kafkaTopic --zookeeper centoshostnameKL1:2181,centoshostnameKL2:2181,centoshostnameKL3:2181
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
本文展示了一个使用Kafka进行消息发布的示例,包括如何通过命令行工具kafka-console-producer.sh发送消息到指定主题,以及如何利用kafka-console-consumer.sh从主题中消费消息并查看结果。
1047

被折叠的 条评论
为什么被折叠?



