[英]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.