主題操作
bin/kafka-topics.sh —zookeeper localhost:2181/kafka
--create --if-not-exists --topic demo_kafka --partitions 2 --replication-factor 2
--alter --topic demo_kafka --partitions 3
--delete --if-exists --topic demo_kafka
--list
--describe --topic demo_kafka
消費者羣組
bin/kafka-consumer-groups.sh --zookeeper gp-bd-master01:2181/kafka
--list
--describe --topic group_demo
生產和消費
bin/kafka-console-producer.sh --broker-list gp-bd-master01:9092 --topic demo_kafka
bin/kafka-console-consumer.sh --broker-list gp-bd-master01:9092 --topic demo_kafka
代碼演示
https://gitee.com/li_yu_kun/TestDemo/tree/master/demo_kafka