Flink命令行启动Job任务

Flink非交互式运行Job任务

Flink命令行启动Job任务

  • 具体命令
flink 参数说明
-c,--class   
-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

  • 方式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/
flink task任务一直重复中
  • 日志报错
# [flink Connecting to remote task manager 'localhost/127.0.0.1:44489] 
  • 看flink ui页面 task Manager节点中有一台显示127.0.0.1的情况,需要把对应节点信息配置本地ip
#修改flink配置文件,在三台flink添加如下两行配置项,需要对应修改自己本机的ip地址
taskmanager.host: 192.168.27.38 
taskmanager.bind-host: 192.168.27.38
  • 然后重启flink集群查看,flink ui页面 task Manager节点
stop-cluster.sh
start-cluster.sh

你可能感兴趣的:(linux,程序人生)