MapReduce服务 MRS-执行Kafka Topic删除操作时发现无法删除:解决办法

时间:2025-02-12 15:01:24

解决办法

  1. ZooKeeper连接失败导致。

    Kafka客户端连接ZooKeeper服务超时。检查客户端到ZooKeeper的网络连通性。

    网络连接失败,通过Manager界面查看Zookeeper服务信息。

    图1 Zookeeper服务信息

    配置错误,修改客户端命令中ZooKeeper地址。

  2. Kafka服务端配置禁止删除。

    通过Manager界面修改delete.topic.enable为true。保存配置并重启服务。

    图2 修改delete.topic.enable

    客户端查询命令,无Topic:test。

    kafka-topics.sh --list --zookeeper 192.168.0.122:24002/kafka

    进入RunningAsController节点日志目录,在controller.log发现Deletion of topic test successfully。

    2016-03-10 10:39:40,665 | INFO  | [delete-topics-thread-3] | [Partition state machine on Controller 3]: Invoking state change to OfflinePartition for partitions [test,2],[test,15],[test,6],[test,16],[test,12],[test,7],[test,10],[test,13],[test,9],[test,19],[test,3],[test,5],[test,1],[test,0],[test,17],[test,8],[test,4],[test,11],[test,14],[test,18] | kafka.controller.PartitionStateMachine (Logging.scala:68)2016-03-10 10:39:40,668 | INFO  | [delete-topics-thread-3] | [Partition state machine on Controller 3]: Invoking state change to NonExistentPartition for partitions [test,2],[test,15],[test,6],[test,16],[test,12],[test,7],[test,10],[test,13],[test,9],[test,19],[test,3],[test,5],[test,1],[test,0],[test,17],[test,8],[test,4],[test,11],[test,14],[test,18] | kafka.controller.PartitionStateMachine (Logging.scala:68)2016-03-10 10:39:40,977 | INFO  | [delete-topics-thread-3] | [delete-topics-thread-3], Deletion of topic test successfully completed | kafka.controller.TopicDeletionManager$DeleteTopicsThread (Logging.scala:68)

  3. Kafka部分节点处于停止或者故障状态。

    启动停止的Broker实例。

    客户端查询命令,无Topic:test。

    kafka-topics.sh --list --zookeeper 192.168.0.122:24002/kafka

    进入RunningAsController节点日志目录,在controller.log发现Deletion of topic test successfully。

    2016-03-10 11:17:56,463 | INFO  | [delete-topics-thread-3] | [Partition state machine on Controller 3]: Invoking state change to NonExistentPartition for partitions [test,4],[test,1],[test,8],[test,2],[test,5],[test,9],[test,7],[test,6],[test,0],[test,3] | kafka.controller.PartitionStateMachine (Logging.scala:68)2016-03-10 11:17:56,726 | INFO  | [delete-topics-thread-3] | [delete-topics-thread-3], Deletion of topic test successfully completed | kafka.controller.TopicDeletionManager$DeleteTopicsThread (Logging.scala:68)

  4. Kafka配置自动创建,且Producer未停止。

    停止相关应用,通过Manager界面修改“auto.create.topics.enable”“false”,保存配置并重启服务。

    图3 修改auto.create.topics.enable

  5. 再次执行delete操作。
support.huaweicloud.com/trouble-mrs/mrs_03_0108.html