Search code examples
apache-flink

What is Apache Flink's detached mode?


I saw this line in Flink documentation but can't figure out what 'detached mode' means. Please help. Thanks.

Run example program in detached mode:

./bin/flink run -d ./examples/batch/WordCount.jar

Solution

  • The Flink CLI runs jobs either in blocking or detached mode. In blocking mode, the CliFrontend (client) process keeps running, blocked, waiting for the job to complete -- after which it will print out some information. In the example below I ran a streaming job, which I cancelled from the WebUI after a few seconds:

    $ flink run target/oscon-1.0-SNAPSHOT.jar 
    Starting execution of program
    Program execution finished
    Job with JobID b02da01c30585bfbc86a23446559987f has finished.
    Job Runtime: 8673 ms
    

    If you run in blocking mode, you can kill the CliFrontend (e.g., with ctrl-C) if you like, and the job will be unaffected, so long as it has run far enough to have submitted the job to the cluster.

    In detached mode, the CliFrontend submits the job to the cluster and then exits straight away.