Flink's savepoint experiment-java

Preface and some preparations

The first thing to be clear is that savepoint and checkpoint are not the same type.

Therefore, when doing savepoint experiments, there is no need to add checkpoint enable options in the code.

Add in $FLINK_HOME/conf/flink-conf.yaml

state.savepoints.dir: hdfs://Desktop:9000/flink-savepoints

The experiment code adopts [2]

------------------------------------------------------------------------------------------------------------------------

Experimental steps

First of all, note that this experiment is carried out in a standalone real cluster, not a local single-section pseudo-distributed cluster.

step Step content
Start Zookeeper, Hadoop, Flink (HA) three clusters (do not start the wrong order)

 

mvn package

cd target

flink run -c WordCount /home/appleyuchi/桌面/Flink_Code/flink_state/savepoint/target/bbb-1.0-SNAPSHOT.jar

get:

Job has been submitted with JobID a5c47eb5cd62ef61f0e0ae66f17aab58

flink savepoint a5c47eb5cd62ef61f0e0ae66f17aab58

Savepoint completed. Path: hdfs://Desktop:9000/flink-savepoints/savepoint-a5c47e-bd57d19f884c
You can resume your program from this savepoint with the run command.

flink cancel a5c47eb5cd62ef61f0e0ae66f17aab58

 

Cancelling job a5c47eb5cd62ef61f0e0ae66f17aab58.
Cancelled job a5c47eb5cd62ef61f0e0ae66f17aab58.

WEB UI display

flink run -s hdfs://Desktop:9000/flink-savepoints/savepoint-a5c47e-bd57d19f884c  -c WordCount -d /home/appleyuchi/桌面/Flink_Code/flink_state/savepoint/target/bbb-1.0-SNAPSHOT.jar

 

Job has been submitted with JobID 00b79db0e9123ebda8dcbb22a8d1e484

 

After restoring through the above command, you will see that the restore information is updated in the web ui

 

At the same time, the results from the previous Task Managers still exist

 

We continue to input heiheihei in nc -lk 9999, can we continue to output in the same taskmanager mentioned above? The answer is no,

The program after restore ran to another taskmanager when outputting the results, so this is a bit imperfect

The above process mainly refers to [1]

Complete code

 

Reference

[1]Flink SavePoint

[2] Intellij runs the wordcount experiment of flink-Java version

Guess you like

Origin blog.csdn.net/appleyuchi/article/details/108865441