Flink启动脚本
# 启动脚本
功能:
获取当前目录下jar包启动,版本变化也可启动,当前目录只能存在一个项目启动jar包
# JAR包所在路径
#JAR_PATH=/data/flink-job/profile-platform
JAR_NAME=profile-platform
START_CLASS=com.cdp.ProfilePlatFormApplication
YS=1
P=25
YJM=2048
YTM=2048
YNM=profile-platform
# 判断是否配置项目部署目录,未配置获取执行时所在目录
if [ -z $JAR_PATH ]; then
echo "JAR_PATH not configured , change to current directory"
JAR_PATH=`pwd`
fi
echo "JAR_PATH : $JAR_PATH"
# 判断如果JAR_NAME不存在,并且项目目录下只有一个Jar包则获取这个目录下的JAR包
JAR_FILE_COUNT=`ls -l |egrep "$JAR_NAME.*.jar$" |wc -l`
if [ $JAR_FILE_COUNT -eq 1 ]; then
echo "JAR_NAME is null or '' , change to current directory JAR"
JAR_NAME_TEMP=$(ls | egrep "$JAR_NAME.*.jar$")
JAR_NAME=${JAR_NAME_TEMP%.jar}
fi
if [ $JAR_FILE_COUNT -ge 2 ]; then
echo "------------------------------------------"
echo "ERROR!!! current directory jar file is too much,start failure,please check"
echo $(ls | egrep "$JAR_NAME.*.jar$")
echo "------------------------------------------"
exit
fi
sh kill.sh
echo '开始启动'
/usr/local/service/flink/bin/flink run \
-m yarn-cluster \
-p $P \
-ys $YS \
-yjm $YJM \
-ytm $YTM \
-yt $JAR_PATH/lib \
-ynm $YNM \
-yD env.java.opts="-Dfile.encoding=UTF-8" \
-c $START_CLASS \
$JAR_PATH/$JAR_NAME.jar \
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
上次更新: 2023/03/20, 14:10:01