当前位置:网站首页>The sparksubmit. Main () method submits external parameters and remotely submits the standalone cluster task
The sparksubmit. Main () method submits external parameters and remotely submits the standalone cluster task
2022-07-27 12:37:00 【Clear glaze in the wind】
One 、 Official document description

Two 、 introduce pom【 Pay attention to the version problem 】
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.2.0</version>
</dependency>
3、 ... and 、 Code
import java.io.IOException;
import org.apache.spark.deploy.SparkSubmit;
public class Main {
public static void main(String[] args) throws IOException {
String appName = "test java web submit job to spark standalone";
String className="cfca.xfraud.mltrain.DataTrainning";
String [] arg0=new String[]{
"--master","spark://192.168.115.64:7077",//ip port
"--deploy-mode","cluster",
"--name",appName,
"--class",className,// Run main class main
"--executor-memory","2G",
"--total-executor-cores","10",
"--executor-cores","2",
"/home/xfraud/ml_train/MachineLearningTraining-0.2.jar",// stay linux Bag on Can be changed to hdfs The path above
"LR", "20180817111111", "66"//jar Parameters in , Notice how the parameters are written here
};
SparkSubmit.main(arg0);
}
}
Four 、 Running results

ps.free -m Check the memory usage on the machine , Pay attention when memory is insufficient ,spark Tasks on the interface will fall into waiting .
边栏推荐
- I/o instance operation
- 20210419 combined sum
- (10) STM32 - systick tick timer
- MySQL paging query instance_ MySQL paging query example explanation "suggestions collection"
- Log4j2.xml configuration details
- 最强分布式锁工具:Redisson
- Top 10 international NFT exchanges
- 20210519 leetcode double pointer
- J9 number theory: how long is the mainstreaming of decentralized identity?
- 详述throw与throws
猜你喜欢

BSP视频教程第21期:轻松一键实现串口DMA不定长收发,支持裸机和RTOS,含MDK和IAR两种玩法,比STM32CubeMX还方便(2022-07-24)

Wechat applet session holding

概述有名内部类与匿名内部类

Unity 2D game tutorial

Fundamentals of mathematics 02 - sequence limit

Necessary foundation: Signature Verification

详述HashSet的add方法

SQL question brushing: find out the current salary of all employees

详述throw与throws

How to use the server to build our blog
随机推荐
Go Beginner (4)
5V boost 9V chip
When the script runs in the background, it redirects the log from the console to its own named file
J9 number theory: how long is the mainstreaming of decentralized identity?
数据湖(二十):Flink兼容Iceberg目前不足和Iceberg与Hudi对比
Plus版SBOM:流水线物料清单PBOM
Go Beginner (3)
Chapter 12 generics
Write and read system temporary files: createtempfile and tempfilecontent[easy to understand]
[excerpt] [medical image] common DICOM thumbnail interpretation and viewer converter conversion tool
最强分布式锁工具:Redisson
正则表达式去除两端空格
Alibaba cloud RDS exception during pool initialization
Complete data summary of lapsus$apt organization that stole Microsoft's source code in March 2022
评价自动化测试优劣的隐性指标
为什么需要外键?
20210519 leetcode double pointer
Photoshop web design tutorial
JVM memory model
Chapter 8 multithreading