Debezium 连接器发件箱转换

Posted

技术标签:

【中文标题】Debezium 连接器发件箱转换【英文标题】:Debezium Connector Outbox Transform 【发布时间】:2020-07-19 18:09:24 【问题描述】:

我正在尝试将 mysql 源连接器与 debezium 支持的发件箱 SMT 一起使用,并具有以下配置。我正在使用最新的 debezium-core 和 debezium-mysql-connector (1.1) jars

curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost: 8083/connectors/ -d '
    "name": "debezium-mysql-connector",
    "config": 
        "connector.class": "io.debezium.connector.mysql.MySqlConnector",
        "tasks.max": "1",
        "database.hostname": "MySql",
        "database.port": "3306",
        "database.user": "**",
        "database.password": "**",
        "database.server.id": "1033113244",
        "database.server.name": "anomaly-changelog",
        "database.whitelist": "anomaly",
        "database.history.kafka.bootstrap.servers": "Kafka:9092",
        "database.history.kafka.topic": "anomaly.schema.history",
        "transforms": "outbox,reroute",
        "transforms.reroute.type": "org.apache.kafka.connect.transforms.RegexRouter",
        "transforms.reroute.regex": "(.*)",
        "transforms.reroute.replacement": "$1-SMT",
        "transforms.outbox.type": "io.debezium.transforms.outbox.EventRouter"
    
'

但我仍然收到以下错误:

"error_code":400,"message":"Connector configuration is invalid and contains the following 2 error(s):\nInvalid value io.debezium.transforms.outbox.EventRouter for configuration transforms.outbox.type: Class io.debezium.transforms.outbox.EventRouter could not be found.\nInvalid value null for configuration transforms.outbox.type: Not a Transformation

我不明白为什么它没有被识别。

【问题讨论】:

好像没有正确安装。您如何安装 Debezium 连接器? Confluent Hub 还是其他方式? 嗨 Robin,我已经下载了 jar 文件并将它们复制到远程机器中 【参考方案1】:

你可以试试这样的:

curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" demo:8083/connectors/ -d ' "name": "order-connector", "config":  "connector.class": "io.debezium.connector.mysql.MySqlConnector", "tasks.max": "1", "database.hostname": "mariadb_order", "database.port": "3306", "database.user": "root", "database.password": "***", "database.server.id": "223344", "database.server.name": "orderdbserver","table.whitelist": "orderdb.outbox", "transforms": "outbox", "transforms.outbox.type" :"io.debezium.transforms.outbox.EventRouter", "database.history.kafka.bootstrap.servers": "kafka:9092", "database.history.kafka.topic":"dbhistory.orderdb", "transforms.outbox.table.fields.additional.placement" : "aggregateid:envelope:id"   '

【讨论】:

以上是关于Debezium 连接器发件箱转换的主要内容,如果未能解决你的问题,请参考以下文章

Debezium 发件箱模式 |如果我们使用 debezium,架构是用 SMT/发件箱表固定的吗

使用 Debezium 的 Quarkus 发件箱模式:如何将自定义列添加到发件箱表

python imaplib 获取 gmail 收件箱主题标题和发件人姓名

如何设置 Kafka 连接器以在 Debezium 中使用自定义转换?

使用 Debezium 提取密钥的转换中不存在字段

Debezium 与 SQL Server 从实际表以及捕获表中获取快照