kafka启动报错ERROR Processor got uncaught exception以及彻底删除topic

启动kafka
命令:/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
报错如下: [2020-08-18 11:14:49,403] ERROR Processor got uncaught exception. (kafka.network.Processor) java.lang.ExceptionInInitializerError at kafka.network.RequestChannel$Request.
<init>(RequestChannel.scala:111) at kafka.network.Processor.$anonfun$processCompletedReceives$1(SocketServer.scala:515) at kafka.network.Processor.$anonfun$processCompletedReceives$1$adapted(SocketServer.scala:505) at scala.collection.Iterator.foreach(Iterator.scala:929) at scala.collection.Iterator.foreach$(Iterator.scala:929) at scala.collection.AbstractIterator.foreach(Iterator.scala:1406) at scala.collection.IterableLike.foreach(IterableLike.scala:71) at scala.collection.IterableLike.foreach$(IterableLike.scala:70) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at kafka.network.Processor.processCompletedReceives(SocketServer.scala:505) at kafka.network.Processor.run(SocketServer.scala:433) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.UnknownHostException: QA-server: QA-server: Name or service not known at java.net.InetAddress.getLocalHost(InetAddress.java:1505) at kafka.network.RequestChannel$.<init>(RequestChannel.scala:41) at kafka.network.RequestChannel$.<clinit>(RequestChannel.scala) ... 12 more [2020-08-18 11:14:50,017] ERROR Processor got uncaught exception. (kafka.network.Processor) java.lang.NoClassDefFoundError: Could not initialize class kafka.network.RequestChannel$ at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:111) at kafka.network.Processor.$anonfun$processCompletedReceives$1(SocketServer.scala:515) at kafka.network.Processor.$anonfun$processCompletedReceives$1$adapted(SocketServer.scala:505) at scala.collection.Iterator.foreach(Iterator.scala:929) at scala.collection.Iterator.foreach$(Iterator.scala:929) at scala.collection.AbstractIterator.foreach(Iterator.scala:1406) at scala.collection.IterableLike.foreach(IterableLike.scala:71) at scala.collection.IterableLike.foreach$(IterableLike.scala:70) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at kafka.network.Processor.processCompletedReceives(SocketServer.scala:505) at kafka.network.Processor.run(SocketServer.scala:433) at java.lang.Thread.run(Thread.java:745) 解决方法:
在/etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.10 QA-server
QA-server为本机主机名
之后继续重启,依然报错
FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentBrokerIdException: Configured broker.id 2 doesn't match stored broker.id 1 in meta.properties. If you moved your data, make sure your configured broker.id matches. If you intend to create a new broker, you should remove all data in your data directories (log.dirs).
    at kafka.server.KafkaServer.getBrokerId(KafkaServer.scala:689)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:194)
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:39)
    at kafka.Kafka$.main(Kafka.scala:67)
    at kafka.Kafka.main(Kafka.scala)

解决方法:
/usr/local/kafka/config/server.properties里修改broker.id=2
/usr/local/kafka/logs/kafka-logs-1/meta.properties里修改broker.id=2
原broker.id=1,修改其它数值,两个配置文件里要保持一致
彻底删除kafka中的topic
方法一:配置参数delete.topic.enable=true没有开启(位置/usr/local/kafka/config/server.properties)
kafka查看topic:/usr/local/kafka/bin/kafka-topics.sh --list --zookeeper xxxx:2181 --topic {topic name}
kafka删除(会显示marked for deletion):/usr/local/kafka/bin/kafka-topics.sh --delete --zookeeper xxxx:2181 --topic {topic name}
删除kafka存储目录,/usr/local/kafka/config/server.properties里log.dirs配置,默认在/tmp/下
登录zookeeper客户端:/usr/local/zookeeper/bin/zkCli.sh
ls /brokers/topics
rmr /brokers/topics/{topic name}
方法二:配置参数delete.topic.enable=true开启(位置/usr/local/kafka/config/server.properties),重启kafka
kafka删除:/usr/local/kafka/bin/kafka-topics.sh --delete --zookeeper xxxx:2181 --topic {topic name}

 

posted @ 2020-08-18 13:24  Frank-hui  阅读(1915)  评论(0编辑  收藏  举报