如何解决Kafka Connect Protobuf配置
我正在尝试创建一个使用protobuf值转换器的kafka接收器连接器。我已经有了使用JSON的此配置的版本,但是现在我需要对其进行更改以使用protobuf消息。
我正在尝试创建具有以下请求的连接器:
curl -X POST localhost:8083/connectors -H "Content-Type: application/json" -d '
{
"name": "jdbc-sink-connector","config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector","topics": "TEST_PROTO","connection.url": "${DB_URL}","value.converter": "io.confluent.connect.protobuf.ProtobufConverter","key.converter": "io.confluent.connect.protobuf.ProtobufConverter","auto.create": true,"auto.evolve": true,"type": "sink","connection.user": "{DB_USER}","connection.password": "${DB_PASS}"
}
}
这会显示以下400条错误消息:
Invalid value io.confluent.connect.protobuf.ProtobufConverter for configuration value.converter: Class io.confluent.connect.protobuf.ProtobufConverter could not be found
我不太明白为什么我不能在这里包括这个。从我看到的文档中可以看出,这是一个适当的值:https://docs.confluent.io/current/connect/userguide.html
任何人都可以帮忙吗?
解决方法
我想在这种情况下,您缺少以下配置:
- value.converter.schema.registry.url
- key.converter.schema.registry.url
- key.converter.schemas.enable
- value.converter.schemas.enable
除了这些,我还尝试使用最新的jdbc jar和最新版本的融合平台。如果这不起作用,请告诉我。
,为清楚起见,在上述答案中添加更多内容,您需要在配置 kafka-connect 时提及以下键的值。
value.converter = "io.confluent.connect.protobuf.ProtobufConverter"
key.converter = "io.confluent.connect.protobuf.ProtobufConverter"
value.converter.schema.registry.url = URL (You should have schema registry service installed and all the producers registering the schema to the service registry before writing to the broker)
key.converter.schema.registry.url = Can be the same URL as above
key.converter.schemas.enable = true (if using Protobuf)
value.converter.schemas.enable = true (if using Protobuf)
要验证转换器是否加载成功,您可以查看 INFO 日志。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。