Debezium-MySQL从连接偏移量手动更改二进制日志位置

时间:2019-12-30 16:30:30

标签: mysql apache-kafka debezium

我有一个正在运行的debezium设置,用于从MySQL执行CDC。现在,我想为另一个MySQL服务器创建一个MySQL连接器。但是我不希望为现有数据创建快照,而是要从特定文件和位置启动debezium新连接器。

  1. 我从stackoverflow中读取了一些问题,他们告诉他们将记录手动插入connect-offsets主题中。但是,如果我这样做,现有的设置会怎样?
  2. 在测试服务器上,我尝试设置上述解决方案,但无法正常工作。
kafka-console-producer --broker-list localhost:9092 --topic connect-offsets
>{"file":"mysql-bin.000002","pos":2012}
>[2019-12-30 05:43:52,666] WARN [Producer clientId=console-producer] Got error produce response with correlation id 4 on topic-partition connect-offsets-5. Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-12-30 05:43:52,767] WARN [Producer clientId=console-producer] Got error produce response with correlation id 5 on topic-partition connect-offsets-5, Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-12-30 05:43:52,870] WARN [Producer clientId=console-producer] Got error produce response with correlation id 6 on topic-partition connect-offsets-5, Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-12-30 05:43:52,975] ERROR Error when sending message to topic connect-offsets with key: null, value: 38 bytes with error: (org.apache.kafka.clients.ingCallback)
org.apache.kafka.common.errors.CorruptRecordException: This message has failed its CRC checksum, exceeds the valid size, has a null key for a compacted to.

我不确定该如何实现。有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

Connect-offsets主题记录用于连接器偏移量管理,对于Debezium MySQL连接器,该主题中的记录具有包含在连接器配置下配置的连接器名称和MySQL服务器名称的键。

为此,如果您只想在该主题中生成记录,则也需要该密钥,然后Debezium连接器将能够读取这些偏移量。