spark线上提交脚本

收藏

spark线上提交脚本,并且向控制一下堆内存:

线上生产提交脚本:
#!/bin/bash

#jar uvf spite-hold-cabin-1.0-SNAPSHOT.jar db.properties
#jar uvf spite-hold-cabin-1.0-SNAPSHOT.jar email.properties
jar uvf spite-hold-cabin-1.0-SNAPSHOT.jar kafka.properties
jar uvf spite-hold-cabin-1.0-SNAPSHOT.jar redis.properties

nohup /home/bigdata/spark-1.6.2-bin-hadoop2.6/bin/spark-submit \
--class com.bs.pid.spiteHoldCabin.run.SpiteHoldCabin \
--master spark://pidfk1:7077 \
--deploy-mode client \
--supervise \
--num-executors 5 \
--executor-memory 1G \
--total-executor-cores 5 \
--conf "spark.executor.extraJavaOptions=-Xmx1g -Xms1g -XX:NewRatio=4 -XX:SurvivorRatio=8 -XX:PermSize=32m -XX:MaxPermSize=64m -Xss256k -XX:ThreadStackSize=128k -XX:MaxDirectMemorySize=1g -XX:-ReduceInitialCardMarks -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:ParallelCMSThreads=4 -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=50 -XX:CMSFullGCsBeforeCompaction=2 -XX:+UseCompressedOops" \
$PWD/spite-hold-cabin-1.0-SNAPSHOT.jar \
pidfk3:9092,pidfk4:9092,pidfk5:9092,pidfk6:9092,pidfk7:9092 SpiteHoldCabinA consumerGroup_1 10 false >> $PWD/start-log/spite-hold-cabin.log 2>&1 &

但是报错了,本意是想控制JVM参数的,所以添加了spark.executor.extraJavaOptions

 

回答

般若回答

问题分析,

传递给executor的额外JVM选项字符串。例如,GC设置或其他日志设置。注意,使用该选项来设置spark属性或heap大小是不合法的。Spark属性应当使用SparkConf对象设置,或者在脚本spark-submit中使用spark-defaults.conf文件。Heap大小可以用spark.executor.memory来设置。

问题解决方法

所以把脚本中的设置堆大小的给去掉就可以了

 

(0)

提交成功