postgresql - Kafka Sink 如何将字段映射到具有不同主题和表模式名称的数据库
问题描述
我目前正在使用主题名称设置 Kafka Sink 连接器waiting-room
,同时调用我的 db 架构waiting_room
。所以我试图将主题消息映射到数据库模式,但我没有看到任何数据进入数据库。所以我尝试了以下场景:
- 因此,由于表模式是
waiting_room
我尝试添加的quote.sql.identifier=ALWAYS
,因为它引用了表名并允许 Kafka 接收器引用它,因此它可以映射到表,但我在 Kafka 接收器中没有看到quote.sql.identifier=ALWAYS
。table.schema 和 Kafka 接收器是否都需要引用才能映射它,或者我如何将表模式映射为下划线并让 kafka 映射它 - 然后,如果我更改了
table.name.format=waiting-room
db schema = gt.namespace."waiting-room" 我没有看到我的 kafka sink 得到更新,而是我的 table.name.format 将 = waiting_room 并且连接器的状态为 404 不成立。
当主题和数据库名称不同时,有没有办法映射并将数据输入数据库
解决方案
尝试使用 Kafka Connect SMT RegexRouter
:
{
"task.max": "1",
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"connection.url": "'"$URL"'",
"topics": "waiting-room",
"transforms": "route",
"transforms.route.type": "org.apache.kafka.connect.transforms.RegexRouter",
"transforms.route.regex": "waiting-room",
"transforms.route.replacement": "gt.namespace.waiting_room",
"errors.tolerance": "all",
"errors.log.enable": "true",
"errors.log.include.messages": true
}
推荐阅读
- graphql - 在 Angular Apollo Graphql 中访问突变结果
- android - 由于无法创建位图,我的单元测试失败
- php - 从对象创建关联数组
- javascript - 编写一个 JavaScript 条件语句来查找三个数字的乘积的符号。显示带有指定符号的警告框
- xpath - XPath:检查是否需要第一个孩子
- python-3.x - 从 2 张图像重建场景的 3D 点云
- python - 在 Windows 10 anaconda 上安装 apache-airflow 时出错
- java - Java LinkedBlockingQueue:检查元素是否已经存在
- c# - 在 C# 中创建 Microsoft Access 查询
- django - 如何为 django 用户添加禁用密码