Consumer is not subscribed to any topics

產生該問題的緣由主要是zookeeper中存在舊版本的kafka-connect topic信息,致使新版本的kafka-connect啓動異常:java

ERROR Unexpected exception in Thread[KafkaBasedLog Work Thread - connect-configs,5,main] (org.apache.kafka.connect.util.KafkaBasedLog:334)
java.lang.IllegalStateException: Consumer is not subscribed to any topics or assigned any partitions
 at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1109)
 at org.apache.kafka.connect.util.KafkaBasedLog.poll(KafkaBasedLog.java:256)
 at org.apache.kafka.connect.util.KafkaBasedLog.access$500(KafkaBasedLog.java:69)
 at org.apache.kafka.connect.util.KafkaBasedLog$WorkThread.run(KafkaBasedLog.java:327)

解決辦法:apache

(1) 使用kafka命令列出全部與connect相關的topiccode

bin/kafka-topics.sh --list --zookeeper 10.255.8.102:2181

輸出:server

__consumer_offsets
ambari_kafka_service_check
connect-configs
connect-offsets
connect-status

(2)使用kafka命令刪除全部與connect相關的topickafka

bin/kafka-topics.sh --delete --zookeeper 10.255.8.102:2181 --topic connect-configs
bin/kafka-topics.sh --delete --zookeeper 10.255.8.102:2181 --topic connect-offsets
bin/kafka-topics.sh --delete --zookeeper 10.255.8.102:2181 --topic connect-status

最後驗證是否刪除:it

bin/kafka-topics.sh --list --zookeeper 10.255.8.102:2181

輸出:io

__consumer_offsets
ambari_kafka_service_check
connect-configs - marked for deletion
connect-offsets - marked for deletion
connect-status - marked for deletion

輸出信息中顯示三個connect topic已被標記刪除了,要想完全刪除,須要在kafkaserver.properties配置文件裏設置delete.topic.enable=truecli

相關文章
相關標籤/搜索