配置Kafka连接Postgress Debezium CDC插件

问题描述 投票:0回答:1

我正在尝试使用kafka connect来读取postgress DB中的更改。我在我的本地系统上运行Kafka,我想在独立模式下使用Kafka connect API来读取postgress服务器数据库的更改。

connect-standalone.sh connect-standalone.properties dbezium.properties

如果有人可以帮我设置CDC postgress debezium连接器的配置属性,我将不胜感激

https://www.confluent.io/connector/debezium-postgresql-cdc-connector/

我按照下面的内容来构建属性

https://debezium.io/docs/connectors/postgresql/#how-the-postgresql-connector-works

默认情况下,Kafka主题的名称采用serverName.schemaName.tableName形式,其中serverName是使用database.server.name配置属性指定的连接器的逻辑名称

这就是我为dbezium.properties提出的

name=cdc_demo
connector.class=io.debezium.connector.postgresql.PostgresConnector
tasks.max=1
plugin.name=wal2json
slot.name=debezium
slot.drop_on_stop=false
database.hostname=localhost
database.port=5432
database.user=postgress
database.password=postgress
database.dbname=test
time.precision.mode=adaptive
database.sslmode=disable

让我们说我创建一个PG模式名称作为演示和表名称作为供应商

所以我需要创建一个名为test.demo.suppliers的主题,以便此插件可以将数据推送到?

也有人可以建议一个docker图像,其中有postgres服务器+有合适的复制插件,如wal2json等?我自己很难配置postgres和CDC插件。

postgresql apache-kafka-connect debezium
1个回答
1
投票

查看the tutorial与相关的Docker Composesample config

您提出的主题听起来是正确的,但如果您将Kafka代理配置为自动创建主题(这是默认行为IIRC),那么它将为您创建,您无需预先创建它。

© www.soinside.com 2019 - 2024. All rights reserved.