检测任务状态
#!/bin/bash
# 设置需要检查的应用名称
APP_NAME="flink_task"
# 获取应用程序状态
status=$(yarn application -list | grep $APP_NAME | awk '{print $7}')
if [[ $status != "RUNNING" && $status != "NEW" && $status != "NEW_SAVING" && $status != "SUBMITTED" && $status != "ACCEPTED" ]]; then
# 启动flink任务
echo "执行重启任务"
exit 0
else
exit 1
fi
提交任务
flink run-application -t yarn-application -ys 1 -yjm 1G -ytm 2G \
-yqu dashboard_user -p 1 -sae -Dyarn.application.name=flink_task \
-Dtaskmanager.memory.process.size=3g \
-Dyarn.application.queue=dashboard_user \
-Dtaskmanager.memory.managed.fraction=0.1 \
-Dtaskmanager.numberOfTaskSlots=1 \
-s hdfs://emr-cluster/tmp/flink//savepoint-908d24-649f4d3a93a6 \
-c com.aa.online.job.FlinkTask \
flink_jar/mp_online-1.0.jar --config_path /tmp/pre_config.conf --fs_defaultFS hdfs://emr-cluster