如何迁移 Confluent 的 Apache Kafka Schema Registry < 5.2.0?

How to migrate Confluent's Apache Kafka Schema Registry < 5.2.0?

我需要迁移 Confluent Schema Registry 5.0.0。

Confluent 的文档说

Starting with Confluent Platform 5.2.0, you can use Confluent Replicator to migrate schemas...

我希望有一个工具也可以为早期版本做这件事。我找不到任何东西,因此,我正在考虑编写一个脚本,使用 Confluent's REST API.

将一个模式注册表复制到另一个模式注册表

但是,在我开始编写它之前,也许有人知道更好的解决方案,或者已经存在的脚本来完成它?

更新:Confluent's Replicator 似乎也适用于旧版本的 Confluent 平台(如果它是源代码),因此如果您迁移到较新的 (>= 5.2.0) 版本的 Confluent 平台从旧的 (< 5.2.0),你可以简单地使用它。

Rest API 将不起作用,因为您无法设置模式的 ID,因此当您复制主题时它们将不相同。

事实上,默认情况下,模式是在名为 _schemas 的 Kafka 主题中编写的。因此,要走的路是将主题从源复制到目标 Kafka 集群。

bin/kafka-console-consumer --bootstrap-server http://[source] --topic _schemas --from-beginning --property print.key=true --timeout-ms 1000 1> schemas.log


bin/kafka-console-producer --broker-list http://[destination] --topic _schemas --property parse.key=true < schemas.log