有的时候可能会遇到_schema topic被人损坏的问题,会报如下的警告:
WARN The replication factor of the schema topic _schemas is less than the desired one of 3. If this is a production environment, it's crucial to add more brokers and increase the replication factor of the topic.
解决方法:
1.删掉_schema topic,注意需要配置delete.topic.enable=true才能彻底删掉
2.按照正常的创建topic的命令重新创建_schema topic
3.还要添加如下配置:
auto.create.topics.enable=false。
4.由于要创建的是一个系统的topic,而系统的topic都是compact机制,所以还要用如下命令把这个topic设置一下compact:
kafka-configs.sh --zookeeper localhost --entity-type topics --entity-name _schemas --alter --add-config cleanup.policy=compact