工作中经常会用到的指令
# 查询topic为test的partition数量
./kafka-topics.sh --zookeeper localhost:2181/kafka --topic test --describe
# 查看kafka上所有的topic
./kafka-topics.sh --zookeeper localhost:2181/kafka --list
# 发送消息
./kafka-console-producer.sh --broker-list localhost:9092 --topic test
# 收取消息
./kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
# 修改topic为test的partition数量(只能越修改越大)
./kafka-topics.sh --zookeeper localhost:2181 --alter --topic test --partitions 8
# 创建名为test的topic
./kafka-topics.sh --create --zookeeper localhost:2181 --topic test --replication-factor 1 --partition 4
# 删除为test的topic
./kafka-topics.sh --delete --zookeeper localhost:2181 --topic test
# 查看所有的group
./kafka-run-class.sh kafka.admin.ConsumerGroupCommand --zookeeper localhost:2181 --list
# 查看数据是否消费完成
./kafka-run-class.sh kafka.admin.ConsumerGroupCommand --zookeeper localhost:2181 --describe --group testGroup