209/5000 您好,我想将选项“--deploy-mode cluster”添加到我的代码 scala 中:
val sparkConf = new SparkConfig ().setMaster ("spark: //192.168.60.80:7077")
不使用shell(命令.\Spark-submit)
我想在 scala 中使用“spark.submit.deployMode”
209/5000 您好,我想将选项“--deploy-mode cluster”添加到我的代码 scala 中:
val sparkConf = new SparkConfig ().setMaster ("spark: //192.168.60.80:7077")
不使用shell(命令.\Spark-submit)
我想在 scala 中使用“spark.submit.deployMode”
使用 SparkConfig:
//set up the spark configuration and create contexts
val sparkConf = new SparkConf().setAppName("SparkApp").setMaster("spark: //192.168.60.80:7077")
val sc = new SparkContext(sparkConf).set("spark.submit.deployMode", "cluster")
使用 SparkSession:
val spark = SparkSession
.builder()
.appName("SparkApp")
.master("spark: //192.168.60.80:7077")
.config("spark.submit.deployMode","cluster")
.enableHiveSupport()
.getOrCreate()
您可以使用
val sparkConf = new SparkConf ().setMaster ("spark: //192.168.60.80:7077").set("spark.submit.deployMode","cluster")