将 cp-schema-registry:3.2.2 更新为 6.2.0 以清理策略问题结束

Updating cp-schema-registry:3.2.2 to 6.2.0 ends in a cleanup policy issue

我正在更新 docker-compose 文件 cp-schema-registry:3.2.2 到 6.2.0。 Zookeeper cp-zookeeper image 和 cp-kafka 也会更新。

如果重新启动文件,模式注册表会抱怨预期的策略:

[2021-08-24 10:19:41,630] ERROR The retention policy of the schema topic _schemas is incorrect. You must configure the topic to 'compact' cleanup policy to avoid Kafka deleting your schemas after a week. Refer to Kafka documentation for more details on cleanup policies (io.confluent.kafka.schemaregistry.storage.KafkaStore)

如果我在 Kafka 映像 cp-kafka:6.2.0 中设置此策略 KAFKA_LOG_CLEANUP_POLICY: compact 乍一看似乎可行。

docker-compose 系统似乎已设置好。 docker-compose 文件向代理发送大量主题。

向 Kafka 发送主题后,代理开始抱怨。

The system will be filled with topics and at the end the broker complains about:
[2021-08-20 09:05:55,019] ERROR [ReplicaManager broker=1] Error processing append operation on partition my-topic-bus-0 (kafka.server.ReplicaManager)
org.apache.kafka.common.InvalidRecordException: One or more records have been rejected

2021-08-20 07:55:28.543  WARN 8 --- [ad | producer-2] org.apache.kafka.common.protocol.Errors  : Unexpected error code: 87.

如果算出87的意思

INVALID_RECORD(87, "This record has failed the validation on broker and hence will be rejected.", InvalidRecordException::new),

我很疑惑Kafka中设置KAFKA_LOG_CLEANUP_POLICY: delete和默认值的问题。此外,模式注册表开始抱怨。谷歌搜索,在这里阅读,在那里阅读,问一些同事我没有理解问题的根源是什么以及如何解决它。有没有人有想法删除仍然作为清理策略的主题?

谢谢, 马库斯

我假设您已经阅读了 Apache Kafka 和 Confluent Platform 这两个版本之间的所有发行和升级说明?有几个内部 Kafka 主题格式更改需要解决(例如 log.message.format.version + inter.broker.protocol.version)。

如果您没有完成这些配置,那么这就解释了您的错误,并且影响的不仅仅是注册表。


您不应修改 所有主题 的默认清理策略以仅修复 _schemas 主题。

相反,您应该只启动代理,然后使用 kafka-topics --alter --topic _schemas 对其进行修改,然后在使用 kafka-topics --describe --topic _schemas 后启动注册表并查看 cleanup.policy=compact