我安装成功Postgres Debezium CDC。现在,我能够捕捉到数据库发生的所有变化。但问题是“之前”字段始终为空。所以,如果我插入一条记录,(id = 1, name = Bill)我就会从 Kafka 获得这些数据:
'payload': {'before': None, 'after': {'id': 1, 'name': 'Bill'}, ...
但是,如果我像这样更新记录:
UPDATE mytable set name = 'Bob' WHERE id = 1
我从卡夫卡那里得到这个:
'payload': {'before': None, 'after': {'id': 1, 'name': 'Bob'}, ...
这就是我配置连接器的方式:
curl -X POST localhost:8083/connectors/ \
-H "Accept:application/json" -H "Content-Type:application/json" -d \
'{
"name": "test-connector",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"tasks.max": "1",
"plugin.name": "pgoutput",
"database.hostname": "postgres",
"database.port": "5432",
"database.user": "postgres",
"database.password": "postgres",
"database.dbname" : "test",
"database.server.name": "postgres",
"database.whitelist": "public.mytable",
"database.history.kafka.bootstrap.servers": "kafka:9092",
"database.history.kafka.topic": "public.topic"
}
}'
那有什么问题,我该如何解决?