Checkpoints make state in Flink fault tolerant by allowing state and the corresponding stream positions to be recovered, thereby giving the application the same semantics as a failure-free execution.
See [Checkpointing](//ci.apache.org/projects/flink/flink-docs-release-1.7/dev/stream/state/checkpointing.html) for how to enable and configure checkpoints for your program.
Checkpoints are by default not retained and are only used to resume a job from failures. They are deleted when a program is cancelled. You can, however, configure periodic checkpoints to be retained. Depending on the configuration these _retained_ checkpoints are _not_ automatically cleaned up when the job fails or is canceled. This way, you will have a checkpoint around to resume from if your job fails.
The `ExternalizedCheckpointCleanup` mode configures what happens with checkpoints when you cancel the job:
...
...
@@ -27,10 +41,20 @@ The `ExternalizedCheckpointCleanup` mode configures what happens with checkpoint
***`ExternalizedCheckpointCleanup.DELETE_ON_CANCELLATION`**: Delete the checkpoint when the job is cancelled. The checkpoint state will only be available if the job fails.
Similarly to [savepoints](savepoints.html), a checkpoint consists of a meta data file and, depending on the state backend, some additional data files. The meta data file and data files are stored in the directory that is configured via `state.checkpoints.dir` in the configuration files, and also can be specified for per job in the code.
#### 通过配置文件设置全局路径
```
state.checkpoints.dir: hdfs:///checkpoints/
```
#### Configure globally via configuration files
...
...
@@ -39,7 +63,11 @@ Similarly to [savepoints](savepoints.html), a checkpoint consists of a meta data
$ bin/flink run -s :checkpointMetaDataPath [:runArgs]
```
A job may be resumed from a checkpoint just as from a savepoint by using the checkpoint’s meta data file instead (see the [savepoint restore guide](../cli.html#restore-a-savepoint)). Note that if the meta data file is not self-contained, the jobmanager needs to have access to the data files it refers to (see [Directory Structure](#directory-structure) above).