- 使用kafka-topics --delete命令删除topic时并没有真正的删除,而是把topic标记为:
- “marked for deletion”,导致重新创建相同名称的Topic时报错“already exists”。
24.1 问题情况
- 登录Kafka集群所在的服务器,创建一个test的topic
[root@cdh1 ~]# kafka-topics --create --zookeeper ip-172-31-1-175.ap-southeast-1.compute.internal:2181 --replication-factor 1 --partitions 1 --topic test
[root@cdh1 ~]# kafka-topics --list --zookeeper ip-172-31-1-175.ap-southeast-1.compute.internal:2181
[root@cdh1 ~]# kafka-topics --delete --zookeeper ip-172-31-1-175.ap-southeast-1.compute.internal:2181 --topic test
- 此处显示“Topic test is marked for deletion”
- 尝试重新创建一个test的Topic
[root@cdh1 ~]# kafka-topics --create --zookeeper ip-172-31-1-175.ap-southeast-1.compute.internal:2