[[https://www.cnblogs.com/xiaodf/p/6093261.html|Kafka Shell基本命令(包括topic的增删改查)]]
===== 启动 =====
=== 启动zk ===
bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
=== 启动kafka ===
bin/kafka-server-start.sh config/server.properties
===== topic管理 =====
=== 创建topic ===
创建单分区单副本的 topic test
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
=== 查看 topic 列表 ===
bin/kafka-topics.sh --list --zookeeper localhost:2181
=== 查看指定 topic 信息 ===
bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
===== 生产与消费 =====
=== 生产消息 ===
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
=== 消费消息 ===
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
# 如果上面不管用的话
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning