简体   繁体   English

如果所有源数据库中的主键相同,我们可以为多个源数据库制作单个 JDBC 接收器连接器吗?

[英]Can we make Single JDBC Sink Connector for multiple source db if primary key is same in all source DB?

Below is my JDBC Sink Connector Configuration Properties.下面是我的 JDBC 接收器连接器配置属性。

    "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
    "transforms.dropPrefix.replacement": "$1",
    "table.name.format": "kafka_${topic}",
    "connection.password": "********",
    "tasks.max": "3",
    "topics": "aiq.db1.Test1,aiq.db1.Test2,aiq.db2.Topic1,aiq.db2.Topic2",
    "batch.size": "3000",
    "transforms": "dropPrefix",
    "transforms.dropPrefix.regex": "aiq.(.*)",
    "transforms.dropPrefix.type": "org.apache.kafka.connect.transforms.RegexRouter",
    "value.converter.schema.registry.url": "http://localhost:8081",
    "value.converter.value.subject.name.strategy": "io.confluent.kafka.serializers.subject.RecordNameStrategy",
    "auto.evolve": "true",
    "connection.user": "admin",
    "name": "MSSQL_jdbc_sink_connect",
    "errors.tolerance": "all",
    "auto.create": "true",
    "value.converter": "io.confluent.connect.avro.AvroConverter",
    "connection.url": "jdbc:sqlserver://mssql",
    "insert.mode": "upsert",
    "key.converter": "io.confluent.connect.avro.AvroConverter",
    "key.converter.schema.registry.url": "http://localhost:8081",
    "pk.mode": "record_value",
    "pk.fields": "id"

If I used this then connector is looking for db1 or db2, which is source db and giving this error.如果我使用它,则连接器正在寻找 db1 或 db2,这是源 db 并给出此错误。

com.microsoft.sqlserver.jdbc.SQLServerException: Database 'db2' does not exist. Make sure that the name is entered correctly.

at io.confluent.connect.jdbc.sink.JdbcSinkTask.getAllMessagesException(JdbcSinkTask.java:150)
at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:102)
... 11 more
[2022-01-25 06:09:09,582] WARN Write of 500 records failed, remainingRetries=10 (io.confluent.connect.jdbc.sink.JdbcSinkTask:92)
com.microsoft.sqlserver.jdbc.SQLServerException: Database 'db2' does not exist. Make sure that the name is entered correctly.

Please let me know Can I create a JDBC sink connector which uses more than one databases for source topic.请让我知道我可以创建一个 JDBC 接收器连接器,它使用多个数据库作为源主题。 If this scenario is possible then How can I achieve this by using JDBC Sink Connector?如果这种情况是可能的,那么如何使用 JDBC 接收器连接器来实现这一点?

AFAIK, the connection.url can only refer to one database at a time, for an authenticated user to that database. AFAIK, connection.url一次只能引用一个数据库,对于该数据库的经过身份验证的用户。

If you need to write different topics to different databases, copy your connector config, and change the appropriate configs如果您需要将不同的主题写入不同的数据库,请复制您的连接器配置,并更改相应的配置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kafka JDBC 源连接器和 Oracle 数据库错误 - Kafka JDBC Source Connector and Oracle DB error 删除不适用于 debezium 源连接器/jdbc-sink-connector - delete is not working for debezium source connector/jdbc-sink-connector Kafka JDBC 接收器连接器 - 是否可以将主题数据作为 json 存储在 DB 中 - Kafka JDBC sink connector - is it possible to store the topic data as a json in DB 如何配置 Debezium 的 MongoDB 源连接器以按照 Postgres JDBC 接收器连接器的预期发送 record_value 中的 pk 字段 - How can I configure Debezium's MongoDB source connector to send the pk fields in the record_value as expected by the Postgres JDBC sink connector Kafka Connect:多个DB2 JDBC源连接器失败 - Kafka Connect: Multiple DB2 JDBC Source Connectors fail 具有主数据库/备份数据库的单个JDBC OracleDataSource / HikariCP - Single JDBC OracleDataSource/HikariCP with primary/backup DB 在Oracle DB中唯一标识源JDBC进程 - Uniquely identify source JDBC process in Oracle DB 如何通过 JDBC 接收器连接器编写 kafka 记录键以分隔列(不是主键)? - How to write kafka record key to separate column (not primary key) by JDBC sink connector? Spring XD jdbc(源)-> jdbc(接收器) - Spring XD jdbc(source) -> jdbc(sink) 不支持的源数据类型:从 Kafka 主题消费时 JDBC Postgres Sink Connector 中的 STRUCT 错误 - Unsupported source data type: STRUCT error in JDBC Postgres Sink Connector when consuming from Kafka topic
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM