我想使用下面的连接器配置将多个表数据发布到同一个Kafka主题,但是我看到下面的异常
例外
由以下原因引起:io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException:正在注册的架构与早期的架构不兼容;错误代码:409
连接器似乎忽略了主题策略属性集,并继续使用旧的$ {topic}键和$ {topic}值主题。
[2019-04-25 22:43:45,590] INFO AvroConverterConfig values:
schema.registry.url = [http://schema-registry:8081]
basic.auth.user.info = [hidden]
auto.register.schemas = true
max.schemas.per.subject = 1000
basic.auth.credentials.source = URL
schema.registry.basic.auth.user.info = [hidden]
value.subject.name.strategy = class io.confluent.kafka.serializers.subject.TopicNameStrategy
key.subject.name.strategy = class io.confluent.kafka.serializers.subject.TopicNameStrategy
连接器配置
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d '{
"name": "two-in-one-connector",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "xxxxxxx",
"database.port": "3306",
"database.user": "xxxxxxx",
"database.password": "xxxxxxxxx",
"database.server.id": "18405457",
"database.server.name": "xxxxxxxxxx",
"table.whitelist": "customers,phone_book",
"database.history.kafka.bootstrap.servers": "broker:9092",
"database.history.kafka.topic": "dbhistory.customer",
"transforms": "dropPrefix",
"transforms.dropPrefix.type":"org.apache.kafka.connect.transforms.RegexRouter",
"transforms.dropPrefix.regex":"(.*)",
"transforms.dropPrefix.replacement":"customer",
"key.converter.key.subject.name.strategy": "io.confluent.kafka.serializers.subject.TopicRecordNameStrategy",
"value.converter.value.subject.name.strategy": "io.confluent.kafka.serializers.subject.TopicRecordNameStrategy"
}
}'
答案 0 :(得分:0)
尝试将策略类设置为连接器配置(JSON)文件中的以下参数,而不是“ key.converter.key.subject.name.strategy ”和“ value.converter.value” .subject.name.strategy ”
"key.subject.name.strategy"
"value.subject.name.strategy"