Client 本地模式 和 Cluster 集群模式 最本质的区别在于:Driver程序在哪里?
Client模式下的Drive就在提交Spark应用程序所在的机器上运行
Cluster模式下的Drive在集群的某台空闲的WorkerNode上运行
1、standalone HA 下的 client 本地模式,提交圆周率Spark应用程序(测试模式中使用)
${SPARK_HOME}/bin/spark-submit \
--master spark://node1.itcast.cn:7077,node2.itcast.cn:7077 \
--deploy-mode client \
--conf "spark.pyspark.driver.python=/root/anaconda3/bin/python3" \
--conf "spark.pyspark.python=/root/anaconda3/bin/python3" \
${SPARK_HOME}/examples/src/main/python/pi.py \
100
2、standalone HA 下的 cluster 集群模式,提交圆周率Spark应用程序
SPARK_HOME=/export/server/spark
${SPARK_HOME}/bin/spark-submit \
--master spark://node1.itcast.cn:7077 \
--deploy-mode cluster \
--driver-memory 512m \
--executor-memory 512m \
--total-executor-cores 2 \
--class org.apache.spark.examples.SparkPi \
${SPARK_HOME}/examples