flink 在idea中编写的wordcount 重新启动后没有从检查点恢复之前的数据,为什么?

启用了检查点和状态后端,看hdfs目录确实有内容,然而重新启动后并没有从检查点恢复数据,这是为什么??
object kafkatest {
  def main(args: Array[String]) {
    val env = StreamExecutionEnvironment.getExecutionEnvironment

    val properties = new Properties()
    properties.setProperty("bootstrap.servers" ,"xiao100:9092")
    properties.setProperty("group.id","flink_consumer")
    env.setStateBackend(new FsStateBackend("hdfs://xiao100:9000/flink/checkpoints"))
    env.getCheckpointConfig.setCheckpointingMode(CheckpointingMode.EXACTLY_ONCE)
    env.setRestartStrategy(RestartStrategies.noRestart())
    env.getCheckpointConfig.isCheckpointingEnabled
    env.enableCheckpointing(6000)
    env.getCheckpointConfig.enableExternalizedCheckpoints(ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION)
    val consumer = new FlinkKafkaConsumer010[String]("test", new SimpleStringSchema, properties)
    val source: DataStream[String] = env.addSource(consumer)

    val flatMap: DataStream[String] = source.flatMap(_.split(","))
    flatMap.map((_,1)).keyBy(_._1).sum(1).print("sum")

    env.execute("EventTime processing example")
  }

}

启动时添加上参数--fromSavepoint hdfs:\\\flink\checkpoints\793ae005b58a783d30d4f0849efd8d02\chk-730貌似是好使了,为什么不能自动恢复呢?

 

你可能感兴趣的:(flink)