0
votes

I am trying to use kafka connect to read changes in postgress DB. I have Kafka running on my local system and i want to use the Kafka connect API in standalone mode to read the postgress server DB changes.

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

i would appreciate if someone can help me with setting up configuration properties for CDC postgress debezium connector

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

I am following the below to construct the properties

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

The name of the Kafka topics takes by default the form serverName.schemaName.tableName, where serverName is the logical name of the connector as specified with the database.server.name configuration property

and here is what i have come up with for 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

Lets say i create a PG schema name as demo and table name as suppliers

So i need to create a topic with name as test.demo.suppliers so that this plugin can push the data to?

Also can someone suggest a docker image which has the postgress server + with suitable replication plugin such as wal2json etc? i am having hard time configuring postgress and the CDC plugin myself.

1

1 Answers

1
votes

Check out the tutorial with associated Docker Compose and sample config.

The topic you've come up with sounds correct, but if you have your Kafka broker configured to auto-create topics (which is the default behaviour IIRC) then it will get created for you and you don't need to pre-create it.