无法删除kafka主题

时间:2017-05-18 01:10:42

标签: apache-kafka apache-zookeeper yahoo-kafka-manager

我正在使用kafka,zookeeper和kafka-manager来管理集群。

我有3个节点集群。在我从一开始就设置的所有集群delete.topic.enable=true

现在,当我想删除某个主题时,它显示以下错误。

topicxyz - marked for deletion

但不会删除。

我也尝试从kafka-manager中删除,并且说

Yikes! KeeperErrorCode = NodeExists for /admin/delete_topics/topicxyz

错误日志:

卡夫卡的管理

[ESC[31merrorESC[0m] k.m.ApiError$ - error : KeeperErrorCode = NodeExists for /admin/delete_topics/topicxyz
org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = NodeExists for /admin/delete_topics/topicxyz
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:119) ~[org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965]
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965]
        at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783) ~[org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965]
        at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:721) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:704) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:108) ~[org.apache.curator.curator-client-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:701) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:477) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:467) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:447) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
[ESC[37minfoESC[0m] k.m.a.KafkaManagerActor - Updating internal state...

kafka 没有错误日志。 zookeeper stdout错误日志只说警告和stderr日志说Invalid config, exiting abnormally

kafka-version :kafka_2.12-0.10.2.0

主题说明

 $ bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic topicxyz
Topic:topicxyz  PartitionCount:1    ReplicationFactor:1 Configs:
    Topic: topicxyz Partition: 0    Leader: -1  Replicas: 3 Isr: 

请帮忙。

2 个答案:

答案 0 :(得分:0)

有时这是由/admin/delete_topics中发现的ZooKeeper节点损坏引起的。登录ZK客户端并删除行为异常的/admin/delete_topics/your_topic_name条目。 根据客户端版本,它会是这样的:

bin/zkCli.sh -server 127.0.0.1:2181 ls /admin/delete_topics ls /brokers/topics rmr /admin/delete_topics/your_topic_name

您现在应该可以使用Kafka Manager或Kafka-topics删除您的主题。您也可以通过删除“ / brokers / topics / your_topic_name”条目来手动删除主题,但是在删除行为不正确的“ delete_topics”条目之后,我发现这是不必要的。

答案 1 :(得分:-1)

我不确定您使用的是哪个kafka版本。但删除某个主题之前有一个错误。请参阅here& here