Spark-3.5版本以下使用Celeborn时,无法使用动态资源,对于低版本的Spark,Celeborn提供了patch。各版本patch如下
https://github.com/apache/incubator-celeborn/tree/main/assets/spark-patch
下载patch,这里下载spark-3版本,将Celeborn_Dynamic_Allocation_spark3_3.patch放至spark-3.3.1源码目录下,和core同一层级,执行如下命令代码合并
bash
patch -p1 < Celeborn_Dynamic_Allocation_spark3_3.patch
重新编译spark源码,并生成spark tgz包
bash
./dev/make-distribution.sh --tgz --name custom-spark -Phadoop-3.2 -Dhadoop.version=3.2.1 \
-Phive-3.2.1 -Phive-thriftserver -Pyarn -DskipTests
提交任务
bash
/opt/apps/SPARK3/spark-3.3.1-bin-custom-spark/bin/spark-submit \
--conf spark.shuffle.manager=org.apache.spark.shuffle.celeborn.SparkShuffleManager \
--conf spark.celeborn.client.spark.shuffle.writer=hash \
--conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
--conf spark.celeborn.master.endpoints=celeborn-master:9097 \
--conf spark.sql.adaptive.enabled=true \
--conf spark.sql.adaptive.skewJoin.enabled=false \
--conf spark.celeborn.client.push.replicate.enabled=false \
--conf spark.dynamicAllocation.enabled=true \
--conf spark.shuffle.service.enabled=false \
--conf spark.celeborn.storage.hdfs.dir=hdfs://hdfs-cluster/celeborn \
--conf spark.dynamicAllocation.initialExecutors=10 \
--conf spark.dynamicAllocation.minExecutors=0 \
--conf spark.dynamicAllocation.maxExecutors=10 \
--conf spark.dynamicAllocation.executorIdleTimeout=30s \
--queue dataAnalysis \
--class com.rs.dsp.etl.jobs.CommonUserTrackSessionDetailD \
--master yarn \
--deploy-mode cluster \
--driver-memory 4GB \
--executor-memory 15G \
--executor-cores 2 \
/root/rs-dsp-spark-1.0-SNAPSHOT-jar-with-dependencies.jar