【问题标题】:Debezium failed - Cannot replicate because the master purged required binary logsDebezium 失败 - 无法复制,因为主服务器清除了所需的二进制日志
【发布时间】:2019-11-10 02:41:09
【问题描述】:

我正在使用 debezium-kafka 来捕获 MySQL 中的更改。对于 MySQL,我使用的是 AWS RDS。 我有一个启用了 GTID 的只读副本配置。我已将 debezium 与副本连接。

但运行几天后,debezium 失败并出现错误:

org.apache.kafka.connect.errors.ConnectException: Cannot replicate because the master purged required binary logs. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period. To find the missing transactions, see the master's error log or the manual for GTID_SUBTRACT. Error code: 1236; SQLSTATE: HY000.
tat io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:230)
tat io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:197)
tat io.debezium.connector.mysql.BinlogReader$ReaderThreadLifecycleListener.onCommunicationFailure(BinlogReader.java:1018)
tat com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:950)
tat com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:580)
tat com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:825)
tat java.base/java.lang.Thread.run(Thread.java:834)
aused by: com.github.shyiko.mysql.binlog.network.ServerException: Cannot replicate because the master purged required binary logs. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period. To find the missing transactions, see the master's error log or the manual for GTID_SUBTRACT.
tat com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:914)
t... 3 more

我无法弄清楚是什么导致了问题,MYSQL 主服务器和副本都运行良好,都已启动并正在运行。那为什么debezium会失败呢?

【问题讨论】:

    标签: mysql apache-kafka amazon-rds apache-kafka-connect debezium


    【解决方案1】:

    好的,我找到了解决方案,我正在使用 Amazon RDS MySQL。 Amazon RDS 通常会尽快清除二进制日志。由于 GTID 在被 Debezium 消耗之前被清除。

    指定RDS保留二进制的小时数:

    call mysql.rds_set_configuration('binlog retention hours', 24);
    

    链接:https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Concepts.MySQL.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-22
      • 2018-10-06
      • 1970-01-01
      • 2019-01-09
      • 2013-05-16
      • 1970-01-01
      • 2023-02-12
      • 1970-01-01
      相关资源
      最近更新 更多