Search code examples
apache-flinkflink-streaming

Is there a way i can trigger savepoint programmatically or via REST API?


I have enabled checkpoint which gets triggered at regular interval and being pushed to S3 bucket.

Can I trigger savepoint programmatically or via REST endpoint, so that save point will be triggered and saved to S3 using state.savepoints.dir ?

Purpose of this savepoint is to maintain a known stable state and can be used to restore at later point of time.

Env:

flink version: 1.12.1
installation on: k8s

Thank you in Advance.


Solution

  • You can use the following path in REST API to create savepoint /jobs/:jobid/savepoints. You will obviously need to know the id of the job You want to trigger savepoint for. The request is a POST request with body:

    {
     "cancel-job":[boolean to indicate if job should be stopped,
     "target-directory": [path in which savepoint should be kept
    }
    

    You can refer to the [docs] for more info.1