我需要使用以下属性:
value.converter.ignore.default.for.nullables=true
在我的设置中,如此处所述。
当我将其设置为环境变量时,一切正常:
CONNECT_VALUE_CONVERTER_IGNORE_DEFAULT_FOR_NULLABLES: true
但是,据我了解,也可以将其设置在连接器级别,这就是我尝试的:
{
"name": "source-mysql-true-local",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "taxify-binlog-db",
"database.port": "3306",
"database.user": "root",
"database.password": "",
"database.server.id": "184054",
"database.server.name": "cdc_mysql_avro.local",
"database.history.kafka.bootstrap.servers": "kafka:29092",
"database.history.kafka.topic": "cdc_dbhistory_mysql.local",
"include.schema.changes": "true",
"snapshot.mode": "schema_only",
"decimal.handling.mode": "string",
"database.exclude.list": "infra,test",
"table.exclude.list": ".*_gho$,.*_ghc$",
"max.queue.size": "24576",
"max.batch.size": "6144",
"sanitize.field.names": "true",
"value.converter.ignore.default.for.nullables": "true" <-- HERE
}
}
而且它不起作用。我做错了什么还是这是不可能的?我使用的连接器是
debezium-mysql
、1.9.7.Final
。
在这种情况下,您需要使用 JSONConverter 的属性
replace.null.with.default
。
{
"name": "source-mysql-true-local",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "taxify-binlog-db",
"database.port": "3306",
"database.user": "root",
"database.password": "",
"database.server.id": "184054",
"database.server.name": "cdc_mysql_avro.local",
"database.history.kafka.bootstrap.servers": "kafka:29092",
"database.history.kafka.topic": "cdc_dbhistory_mysql.local",
"include.schema.changes": "true",
"snapshot.mode": "schema_only",
"decimal.handling.mode": "string",
"database.exclude.list": "infra,test",
"table.exclude.list": ".*_gho$,.*_ghc$",
"max.queue.size": "24576",
"max.batch.size": "6144",
"sanitize.field.names": "true",
"value.converter.replace.null.with.default": "true"
}