1.standlone模式下
公式:execuoterNum = spark.cores.max/spark.executor.cores
相關參數在啓動具體應用時指定
例如啓動基於standlone模式的spark sql的thrift 接口時 設置 這兩個參數
--total-executor-cores
--executor-cores
它們共同決定了當前應用 啓動executor的個數
$SPARK_HOME/sbin/start-thriftserver.sh --executor-memory 20g --driver-memory 6g --total-executor-cores 288 --executor-cores 2
2.在yarn模式下
直接指定 –num-executors 這個參數
例如
$SPARK_HOME/bin/spark-submit --master yarn --deploy-mode cluster --class you.class.Name - -executor-memory 1g --executor-cores 1 --num-executors 8 --driver-memory 2g /you/jar.jar