問題描述
我已閱讀http://debezium.io/docs/connectors/mysql/ 但我找不到有關是否可以配置 debezium 以便將 2 個(或更多)表中的更改寫入相同的單個 kafka 主題的任何信息?在我看來,它總是 1 個表 -> 1 個主題.
I've read http://debezium.io/docs/connectors/mysql/ but I could not find any info about whether debezium can be configured so that changes from 2 (or more) tables could be written to the same, single kafka topic? It seems to me that it is always 1 table -> 1 topic.
推薦答案
是的,使用 單條消息根據(jù)您確定的鏈接進行轉(zhuǎn)換.您可以使用正則表達式 (regex) 將表映射到所需的主題.io.debezium.transforms.ByLogicalTableRouter
或 org.apache.kafka.connect.transforms.RegexRouter
都可以解決問題.有后者的例子 在這里的這篇文章:
Yes, use Single Message Transforms, per the link you identified. You can use regular expressions (regex) to map the tables to the topic required. Both io.debezium.transforms.ByLogicalTableRouter
or org.apache.kafka.connect.transforms.RegexRouter
should do the trick. There's an example of the latter in this post here:
"transforms":"dropPrefix",
"transforms.dropPrefix.type":"org.apache.kafka.connect.transforms.RegexRouter",
"transforms.dropPrefix.regex":"DC1-TEST-(.*)",
"transforms.dropPrefix.replacement":"$1"
這篇關于是否可以在 Debezium 中配置 table_name =>卡夫卡主題映射?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!