开发者社区 > 大数据与机器学习 > 实时计算 Flink > 正文

flink cdc2.4.1版本连接mysql,运行一段时间后就会报错,这个有修复吗?

flink cdc2.4.1版本连接mysql,运行一段时间后就会报错,这个有修复吗,有可能binlog发生轮换了?
The connector is trying to read binlog starting at Struct{version=1.9.7.Final,connector=mysql,name=mysql_binlog_source,ts_ms=1696934695426,db=,server_id=0,file=mysql-bin.048798,pos=3616538,row=0}, but this is no longer available on the server. Reconfigure the connector to use a snapshot when needed.2023-10-10 18:44:55,451 flink-akka.actor.default-dispatcher-23 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph [] - Source: mysqlSource (1/1) (c9e62e21cac675563537cc7c638a0c0e_bc764cd8ddf7a0cff126f51c16239658_0_0) switched from RUNNING to FAILED on container_e12_1695360459197_0143_01_000002 @ flink-p2 (dataPort=41056).
java.lang.RuntimeException: One or more fetchers have encountered exception
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherManager.checkErrors(SplitFetcherManager.java:261) ~[flink-connector-files-1.17.1.jar:1.17.1]
at org.apache.flink.connector.base.source.reader.SourceReaderBase.getNextFetch(SourceReaderBase.java:169) ~[flink-connector-files-1.17.1.jar:1.17.1]
at org.apache.flink.connector.base.source.reader.SourceReaderBase.pollNext(SourceReaderBase.java:131) ~[flink-connector-files-1.17.1.jar:1.17.1]
at org.apache.flink.streaming.api.operators.SourceOperator.emitNext(SourceOperator.java:417) ~[drs-server.jar:?]
at org.apache.flink.streaming.runtime.io.StreamTaskSourceInput.emitNext(StreamTaskSourceInput.java:68) ~[drs-server.jar:?]
at org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:65) ~[drs-server.jar:?]
at org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:550) ~[drs-server.jar:?]
at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxLoop(MailboxProcessor.java:231) ~[drs-server.jar:?]
at org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxLoop(StreamTask.java:839) ~[drs-server.jar:?]
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:788) ~[drs-server.jar:?]
at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:952) ~[drs-server.jar:?]
at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:931) ~[drs-server.jar:?]
at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:745) ~[drs-server.jar:?]
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:562) ~[drs-server.jar:?]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_311]
Caused by: java.lang.RuntimeException: SplitFetcher thread 519 received unexpected exception while polling the records
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:165) ~[flink-connector-files-1.17.1.jar:1.17.1]
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.run(SplitFetcher.java:114) ~[flink-connector-files-1.17.1.jar:1.17.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_311]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_311]
... 1 more
Caused by: java.lang.IllegalStateException: The connector is trying to read binlog starting at Struct{version=1.9.7.Final,connector=mysql,name=mysql_binlog_source,ts_ms=1696934695426,db=,server_id=0,file=mysql-bin.048798,pos=3616538,row=0}, but this is no longer available on the server. Reconfigure the connector to use a snapshot when needed.
at com.ververica.cdc.connectors.mysql.debezium.task.context.StatefulTaskContext.loadStartingOffsetState(StatefulTaskContext.java:203) ~[drs-server.jar:?]
at com.ververica.cdc.connectors.mysql.debezium.task.context.StatefulTaskContext.configure(StatefulTaskContext.java:127) ~[drs-server.jar:?]
at com.ververica.cdc.connectors.mysql.debezium.reader.BinlogSplitReader.submitSplit(BinlogSplitReader.java:105) ~[drs-server.jar:?]
at com.ververica.cdc.connectors.mysql.debezium.reader.BinlogSplitReader.submitSplit(BinlogSplitReader.java:73) ~[drs-server.jar:?]
at com.ververica.cdc.connectors.mysql.source.reader.MySqlSplitReader.pollSplitRecords(MySqlSplitReader.java:109) ~[drs-server.jar:?]
at com.ververica.cdc.connectors.mysql.source.reader.MySqlSplitReader.fetch(MySqlSplitReader.java:80) ~[drs-server.jar:?]
at org.apache.flink.connector.base.source.reader.fetcher.FetchTask.run(FetchTask.java:58) ~[flink-connector-files-1.17.1.jar:1.17.1]
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:162) ~[flink-connector-files-1.17.1.jar:1.17.1]
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.run(SplitFetcher.java:114) ~[flink-connector-files-1.17.1.jar:1.17.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_311]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_311]
... 1 more

展开
收起
真的很搞笑 2023-10-18 16:19:29 140 0
1 条回答
写回答
取消 提交回答
  • 这个问题可能是由于MySQL的binlog轮换导致的。你可以尝试以下方法来解决这个问题:

    1. 检查MySQL的binlog文件是否已经轮换,如果已经轮换,你需要重新配置Flink CDC以使用新的binlog文件。你可以在MySQL的配置文件(my.cnf或my.ini)中找到binlog文件的位置和名称。

    2. 如果你确定binlog文件没有轮换,那么可能是Flink CDC的配置有问题。你可以尝试修改Flink CDC的配置文件,例如增加max-retries参数的值,以便在读取binlog时有更多的重试机会。

    3. 如果问题仍然存在,你可以考虑升级到更高版本的Flink CDC,因为新版本可能已经修复了这个问题。

    4. 另外,你也可以尝试在Flink作业中添加一个自定义的UDF函数,用于处理binlog事件。这个UDF函数可以捕获binlog事件,并将其转换为Flink可以理解的数据格式。这样,即使binlog发生轮换,你的Flink作业仍然可以正常运行。

    2023-10-19 14:25:21
    赞同 展开评论 打赏

实时计算Flink版是阿里云提供的全托管Serverless Flink云服务,基于 Apache Flink 构建的企业级、高性能实时大数据处理系统。提供全托管版 Flink 集群和引擎,提高作业开发运维效率。

相关产品

  • 实时计算 Flink版
  • 热门讨论

    热门文章

    相关电子书

    更多
    搭建电商项目架构连接MySQL 立即下载
    搭建4层电商项目架构,实战连接MySQL 立即下载
    PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

    相关镜像