官方提供了获取执行计划的WEB页面. 入口 : https://flink.apache.org/visualizer/
获取执行计划的json字符串很简单. 就是在代码里面加一个输出就行了.
System.out.println(env.getExecutionPlan());
在这里插入图片描述
{ "nodes" : [ { "id" : 1, "type" : "Source: Socket Stream", "pact" : "Data Source", "contents" : "Source: Socket Stream", "parallelism" : 1 }, { "id" : 2, "type" : "Flat Map", "pact" : "Operator", "contents" : "Flat Map", "parallelism" : 4, "predecessors" : [ { "id" : 1, "ship_strategy" : "REBALANCE", "side" : "second" } ] }, { "id" : 4, "type" : "Window(TumblingProcessingTimeWindows(5000), ProcessingTimeTrigger, ReduceFunction$1, PassThroughWindowFunction)", "pact" : "Operator", "contents" : "Window(TumblingProcessingTimeWindows(5000), ProcessingTimeTrigger, ReduceFunction$1, PassThroughWindowFunction)", "parallelism" : 4, "predecessors" : [ { "id" : 2, "ship_strategy" : "HASH", "side" : "second" } ] }, { "id" : 5, "type" : "Sink: Print to Std. Out", "pact" : "Data Sink", "contents" : "Sink: Print to Std. Out", "parallelism" : 1, "predecessors" : [ { "id" : 4, "ship_strategy" : "REBALANCE", "side" : "second" } ] } ] }
放大
,缩小
,重置
. 根据需要进行操作…