./kafka-topics.sh --zookeeper 10.128.106.52:2181 --list
./kafka-topics.sh --zookeeper 10.128.106.52:2181 --topic ai_jl_analytic --describe
./kafka-consumer-groups.sh --bootstrap-server 10.128.106.52:9092 --list
./kafka-consumer-groups.sh --bootstrap-server 10.128.106.52:9092 --group ai-trace --describe
./kafka-topics.sh --create --zookeeper 10.128.106.52:2181 --topic test --partitions 8 --replication-factor 1 #创建topic名为test,分区数为8,副本数为1
./kafka-topics.sh --zookeeper 10.128.106.52:2181 -alter --partitions 12 --topic test
./kafka-topics.sh --zookeeper 10.128.106.52:2181 --delete --topic test
执行topic删除命令时,出现提示
Topic test is marked for deletion. Note: This will have no impact if delete.topic.enable is not set to true.
这条命令其实并不执行删除动作,仅仅是在zookeeper上标记该topic要被删除而已,同时也提醒用户一定要提前打开delete.topic.enable开关,否则删除动作是不会执行的。
解决办法:
a)在server.properties中设置delete.topic.enable参数为ture
b)如下操作:
1.登录zookee客户端:./bin/zookeeper-client
2.找到topic所在目录:ls /brokers/topics
3.执行删除命令:rmr /brokers/topics/test
./kafka-console-producer.sh --broker-list 10.128.106.52:9092 --topic test
./kafka-console-consumer.sh --bootstrap 10.128.106.52:9092 --topic server
上一篇:Spring Boot 热部署