Debezium 能否捕获 Postges 物化视图的变化 [英] Can Debezium Capture Changes of a Postges Materialized View

查看:27
本文介绍了Debezium 能否捕获 Postges 物化视图的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在尝试使用 Debezium 来捕获 Postgres 数据库中 4 个表的更改.我们目前知道,对于这个用例,我们可以使用 kafka-streams 应用程序来加入/聚合 KTable 的表,但是我们希望保持 kafka-stream 拓扑简单,因此我们的想法是使用来自 Postgres 的物化视图和捕捉它的变化.

We are currently trying to use Debezium for capturing changes of 4 tables in a Postgres database. We are currently aware that for this use case we could use a kafka-streams app to join/aggregate tables for a KTable, however we want to keep kafka-stream topology simple, so the idea would be to use a Materialized View from Postgres and capture it changes.

是否可以这样做,如果可以,我们应该如何配置它?

Is it possible to do this, if so than how should we configure it?

Kafka Connect 源配置:

{
"name": "campaign-db-source-connector",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "key.converter": "io.confluent.connect.avro.AvroConverter",
    "value.converter": "io.confluent.connect.avro.AvroConverter",
    "key.converter.schema.registry.url": "http://schema-registry:8081",
    "value.converter.schema.registry.url": "http://schema-registry:8081",
    "tasks.max": "1",
    "database.hostname": "campaign-db",
    "database.port": "5432",
    "database.user": "postgres",
    "database.password": "postgres",
    "database.dbname" : "campaigndb",
    "database.server.name": "campaign-db"
  }
 }

此配置目前可以从单个表中捕获所有更改,但不能从物化视图中捕获.(没有创建话题)

This config currently can capture all changes from individual tables but not from materialized view. (There is no topic created)

推荐答案

否,Debezium Postgres 连接器无法从视图捕获更改.您要么必须将连接保留在表中并捕获它,要么确实使用 Kafka Streams 之类的东西来创建连接.

No, the Debezium Postgres connector cannot capture changes from a view. You'd either have to persist your join in a table and capture that or indeed use something like Kafka Streams to create the join.

这篇关于Debezium 能否捕获 Postges 物化视图的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆