Kafka创建topic:
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 3 --topic test
kafka生产者
./kafka-console-producer.sh --broker-list 192.168.69.64:9092 --topic queue_command_to_device_sungrow
kafka消费者
./kafka-console-consumer.sh --zookeeper localhost:2181 --topic queue_command_to_device_sungrow
查看topic详细信息
./kafka-topics.sh --zookeeper localhost:2181 --topic sungrow_queue_protocol_r2p3 --describe
查看主题
bin/kafka-topics.sh --list --zookeeper 192.168.69.64:2181
删除主题
[root@kafka2 bin]# ./kafka-topics.sh --delete --zookeeper localhost:2181 --topic sungrow_queue_ssmerge_r2p1
Topic sungrow_queue_ssmerge_r2p1 is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.
本文详细介绍如何使用Kafka进行主题的创建、生产消息、消费消息、查看及删除主题的操作流程。包括具体的命令行操作,如使用kafka-topics.sh脚本进行主题管理,以及kafka-console-producer.sh和kafka-console-consumer.sh进行消息的生产和消费。
1259

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



