Flink命令行启动Job任务

88 阅读1分钟

Flink非交互式运行Job任务

Flink命令行启动Job任务

  • 具体命令
flink 参数说明
-c,--class <classname>  
-d,--detached  后台运行
-p,--parallelism 并行度

[test@xxx ~]$ flink run -d  -c class_name Job -p 3 ./flink-statics-1.0.jar -zookeeper "10.130.41.51:2181,10.130.41.52:2181,10.130.41.121:2181" 

Flink查看当前运行Job

  • 具体命令
[test@xxx ~]$  flink list
Waiting for response...
------------------ Running/Restarting Jobs -------------------
11.04.2024 11:02:02 : a36265e1e8398089b5418f6420e47602 : testV1.0-topic:ent_record_table (RUNNING)
11.04.2024 14:01:17 : 655c9cb918ac231566d787b650b3539b : 坐席V1.0-topic:agent_detail (RUNNING)
11.04.2024 14:17:23 : 32b9bc59b516a137ddc238df33c07d2f : 处理坐席V1.0-topic:agent_detail (RUNNING)
--------------------------------------------------------------
No scheduled jobs.

Flink 停止运行 Job

  • 具体命令
[test@xxx ~]$ flink  stop  -d 32b9bc59b516a137ddc238df33c07d2f
Suspending job "32b9bc59b516a137ddc238df33c07d2f" with a savepoint.
Savepoint completed. Path: hdfs://flinkha/flink-savepoints/savepoint-32b9bc-c6269a3b7364

[test@xxx ~]$  flink list
Waiting for response...
------------------ Running/Restarting Jobs -------------------
11.04.2024 11:02:02 : a36265e1e8398089b5418f6420e47602 : testV1.0-topic:ent_record_table (RUNNING)
11.04.2024 14:01:17 : 655c9cb918ac231566d787b650b3539b : 坐席V1.0-topic:agent_detail (RUNNING)
--------------------------------------------------------------
No scheduled jobs.

Flink停止运行job

  • 方式1 通过stop命令去停止job
[test@xxx ~]$ flink  stop  -d 32b9bc59b516a137ddc238df33c07d2f
Suspending job "32b9bc59b516a137ddc238df33c07d2f" with a savepoint.
Savepoint completed. Path: hdfs://flinkha/flink-savepoints/savepoint-32b9bc-c6269a3b7364

[test@xxx ~]$  flink list
Waiting for response...
------------------ Running/Restarting Jobs -------------------
11.04.2024 11:02:02 : a36265e1e8398089b5418f6420e47602 : testV1.0-topic:ent_record_table (RUNNING)
11.04.2024 14:01:17 : 655c9cb918ac231566d787b650b3539b : 坐席V1.0-topic:agent_detail (RUNNING)
--------------------------------------------------------------
No scheduled jobs.
  • 方式2 通过调http接口来停止job任务
curl -X PATCH http://localhost:8081/jobs/32b9bc59b516a137ddc238df33c07d2f/