kafka启动报错missingTopicsFatalistrue的解决
kafka 启动报错:missingTopicsFatal is true
报错信息
t.ApplicationContextException: Failed to start bean 'org.fig.internalKafkaListenerEndpointRegistry'; nested exception is java.lang.IllegalStateException: Topic(s) [async] is/are not present and missingTopicsFatal is true
at t.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
at t.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at t.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at t.support.DefaultLif
kafka命令ecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at t.Refresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at t.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.boot.t.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-
2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
at t.fresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
at org.springframework.boot.fresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-
2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
报错原因:消费监听接⼝监听的主题不存在时,默认会报错
解决⽅法:
配置⽂件中将listener的属性missingTopicsFatal设置为false
spring:
kafka:
listener:
missing-topics-fatal: false
kafka常见报错警告异常解决
1.⾃⾏修改server.properties中broker id后造成与meta.properties中数据不匹配
kafkamon.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).
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.
为什么这⾥会是这样存储__consumer_offsets的呢:
[1.] 将所有 N Broker 和待分配的 i 个 Partition 排序
[2.] 将第 i 个 Partition 分配到第(i mod n)个 Broker 上
3.删除topic时
Topic frist is already marked for deletion.
彻底删除topic:
[1. ] 删除Topic,able=true这⾥要设置为true
[2. ] 删除log⽇志
[3. ] 删除ZK中的Topic记录
命令:./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 标记消失当然,这⾥是你able设置为false时Zookeeper下才会有这个节点。
以上为个⼈经验,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论