gpt4 book ai didi

kafka 启动报错 missingTopicsFatal is true的解决

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 30 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章kafka 启动报错 missingTopicsFatal is true的解决由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

kafka 启动报错:missingTopicsFatal is true

报错信息 。

org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is java.lang.IllegalStateException: Topic(s) [async] is/are not present and missingTopicsFatal is true at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE] 。

报错原因:消费监听接口监听的主题不存在时,默认会报错 。

解决方法:

配置文件中将listener的属性missingTopicsFatal设置为false 。

  1. spring:
  2. kafka:
  3. listener:
  4. missing-topics-fatal: false

kafka常见报错警告异常解决

1.自行修改server.properties中broker id后造成与meta.properties中数据不匹配 。

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). 。

kafka 启动报错 missingTopicsFatal is true的解决

2.__consumer_offsets这个topic是由kafka自动创建的,默认49个,这个topic是不能被删除的! 。

Error while executing topic command : Topic __consumer_offsets is a kafka internal topic and is not allowed to be marked for deletion. 。

kafka 启动报错 missingTopicsFatal is true的解决

为什么这里会是这样存储__consumer_offsets的呢:

  • [1.] 将所有 N Broker 和待分配的 i 个 Partition 排序
  • [2.] 将第 i 个 Partition 分配到第(i mod n)个 Broker 上

3.删除topic时 。

Topic frist is already marked for deletion. 。

kafka 启动报错 missingTopicsFatal is true的解决

彻底删除topic:

  • [1. ] 删除Topic,delete.topic.enable=true这里要设置为true
  • [2. ] 删除log日志
  • [3. ] 删除ZK中的Topic记录

kafka 启动报错 missingTopicsFatal is true的解决

命令:./bin/zkCli.sh 。

找到topic所在的目录:ls /brokers/topics 。

执行命令:rmr /brokers/topics/{topic name}即可,此时topic被彻底删除.

另外被标记为marked for deletion的topic你可以在zookeeper客户端中通过命令获得:ls /admin/delete_topics/{topic name},如果你删除了此处的topic,那么marked for deletion 标记消失 。

当然,这里是你delete.topic.enable设置为false时Zookeeper下才会有这个节点.

以上为个人经验,希望能给大家一个参考,也希望大家多多支持我们.

原文链接:https://blog.csdn.net/weixin_43931625/article/details/102739002 。

最后此篇关于kafka 启动报错 missingTopicsFatal is true的解决的文章就讲到这里了,如果你想了解更多关于kafka 启动报错 missingTopicsFatal is true的解决的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com