在没有 Confluent Schema Registry 的情况下在 KafkaConnect 中使用 Avro [英] Use Avro in KafkaConnect without Confluent Schema Registry

查看:55
本文介绍了在没有 Confluent Schema Registry 的情况下在 KafkaConnect 中使用 Avro的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在当前的基础设施中设置了 vanilla apache Kafka,我们开始记录一些我们想要使用 Kafka Connect 处理的数据.目前我们使用 Avro 作为我们的消息格式,但我们的基础设施中没有 Schema Registry.将来,我们计划用 Confluent 替换当前堆栈并使用 Schema Registry 和 Connect,但有一段时间我们只需要为此部署 Connect.

We have vanilla apache Kafka setup in current infrastructure and we started logging some data that we want to process using Kafka Connect. Currently we use Avro for our message format, but there's no Schema Registry in our infrastructure. In future, we plan to replace current stack with Confluent and use Schema Registry and Connect, but for some time we need to deploy only Connect for that.

是否可以以某种方式配置 Connect 接收器,以便它们使用显式的 avsc 文件或模式,而无需连接到模式注册表,也无需使用带有魔术字节和模式 ID 的 Confluent 格式?

Is it possible to configure Connect sinks somehow so they use explicit avsc files or schema without connecting to Schema Registry and without using Confluent format with magic bytes and schema ID?

推荐答案

是的,可以使用 Github 上的registryless-avro-converter.

按照那里的构建说明,在加载其他连接器时将 JAR 添加到您的 plugin.path 文件夹,然后像这样设置

Follow the build instructions there, add a JAR to your plugin.path folder as other connectors are loaded, then setup like so

key.converter=me.frmr.kafka.connect.RegistrylessAvroConverter
key.converter.schema.path=/path/to/schema/file.avsc
value.converter=me.frmr.kafka.connect.RegistrylessAvroConverter
value.converter.schema.path=/path/to/schema/file.avsc

请注意,这将要求您在所有 Connect 工作人员上存储/维护/同步架构文件,但是

Note that this will require you to store/maintain/sync the schema files on all Connect workers, however

或者,您可以使用普通 Kafka 设置模式注册表 - 没有理由进行一些融合迁移";因为除了您的 Serializer & 之外,注册表不需要任何基础结构更改.解串器配置.

Alternatively, you can setup the Schema Registry with your vanilla Kafka - No reason to do some "Confluent migration" since the registry doesn't require any infrastructure changes other than your Serializer & Deserializer configs.

这篇关于在没有 Confluent Schema Registry 的情况下在 KafkaConnect 中使用 Avro的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆