java Flink 如何每隔 1000 ms 进行启动一个检查点【设置 checkpoint 的周期】
在 Flink 中,可以通过设置 CheckpointConfig 来设置 checkpoint 的周期。以下是一个示例代码:
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.enableCheckpointing(1000); // 设置 checkpoint 的周期为 1000ms
CheckpointConfig checkpointConfig = env.getCheckpointConfig();
checkpointConfig.setCheckpointTimeout(60000); // 设置 checkpoint 的超时时间为 60s
在上述代码中,我们通过调用 enableCheckpointing 方法来设置 checkpoint 的周期为 1000ms。然后,我们可以通过 getCheckpointConfig 方法获取 CheckpointConfig 对象,从而对 checkpoint 进行更细致的设置,比如设置 checkpoint 的超时时间等。
需要注意的是,每个 Flink 任务的 checkpoint 周期是独立的,因此需要在每个任务中分别设置 checkpoint 的周期
原文地址: https://www.cveoy.top/t/topic/fFhg 著作权归作者所有。请勿转载和采集!