Debezium:双值 serialization/deserializtion 问题
Debezium: double values serialization/deserializtion issue
我在使用带有 mysql.
的 Debezium 连接器通过 CDC 从 mysql table 获取 Double 值时遇到问题
下面是连接器道具:
{
"name": "test",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "10",
"database.hostname": "mysql.default",
"database.port": "3306",
"database.user": "debezium",
"database.password": "debezium",
"database.server.name": "mydb",
"database.history.kafka.bootstrap.servers": "kafka:9092",
"database.history.kafka.topic": "schema-changes.mysql",
"table.whitelist": "mydb.request",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"decimal.handing.mode":"double",
"key.converter.schemas.enable": "false",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "false",
"topic.creation.default.retention.ms": 86400000,
"snapshot.locking.mode": "none",
"topic.creation.default.replication.factor":3,
"topic.creation.default.partitions": 3
}
}
上面的配置生成了名称为 mydb.mydb.request
的主题,当我尝试通过 CLI 控制台消费者读取该主题时,我将所有双精度值反序列化为字符串(total_amount_without_discount、total_amount , discount_amount) 如下:
{
"id": 123,
.
.
.
"total_amount_without_discount": "Al/Q",
"total_amount": "AlqI",
"discount_amount": "BUg="
}
谁能指出问题出在哪里,或者配置可能有什么问题?
提前致谢!
输入有误
"decimal.handling.mode":"double"
字段。
我的假设,问题是由于上述配置字段的默认值是 precise
,根据文档将其映射到字节(文字类型)(https://debezium.io/documentation/reference/connectors/mysql.html#mysql-decimal-types )
注意:double
在confluent docs下没有提到,只存在于debezium docs下
这里是合流文档
https://docs.confluent.io/5.5.1/connect/debezium-connect-mysql/mysql_source_connector_config.html
我在使用带有 mysql.
的 Debezium 连接器通过 CDC 从 mysql table 获取 Double 值时遇到问题下面是连接器道具:
{
"name": "test",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "10",
"database.hostname": "mysql.default",
"database.port": "3306",
"database.user": "debezium",
"database.password": "debezium",
"database.server.name": "mydb",
"database.history.kafka.bootstrap.servers": "kafka:9092",
"database.history.kafka.topic": "schema-changes.mysql",
"table.whitelist": "mydb.request",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"decimal.handing.mode":"double",
"key.converter.schemas.enable": "false",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "false",
"topic.creation.default.retention.ms": 86400000,
"snapshot.locking.mode": "none",
"topic.creation.default.replication.factor":3,
"topic.creation.default.partitions": 3
}
}
上面的配置生成了名称为 mydb.mydb.request
的主题,当我尝试通过 CLI 控制台消费者读取该主题时,我将所有双精度值反序列化为字符串(total_amount_without_discount、total_amount , discount_amount) 如下:
{
"id": 123,
.
.
.
"total_amount_without_discount": "Al/Q",
"total_amount": "AlqI",
"discount_amount": "BUg="
}
谁能指出问题出在哪里,或者配置可能有什么问题?
提前致谢!
输入有误
"decimal.handling.mode":"double"
字段。
我的假设,问题是由于上述配置字段的默认值是 precise
,根据文档将其映射到字节(文字类型)(https://debezium.io/documentation/reference/connectors/mysql.html#mysql-decimal-types )
注意:double
在confluent docs下没有提到,只存在于debezium docs下
这里是合流文档
https://docs.confluent.io/5.5.1/connect/debezium-connect-mysql/mysql_source_connector_config.html