当前位置:网站首页>SparkSubmit.main()方法提交外部参数,远程提交standalone集群任务
SparkSubmit.main()方法提交外部参数,远程提交standalone集群任务
2022-07-27 12:32:00 【风间净琉璃】
一、官方文档描述

二、引入pom【注意版本问题】
<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>
三、代码
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端口
"--deploy-mode","cluster",
"--name",appName,
"--class",className,//运行主类main
"--executor-memory","2G",
"--total-executor-cores","10",
"--executor-cores","2",
"/home/xfraud/ml_train/MachineLearningTraining-0.2.jar",//在linux上的包 可改为hdfs上面的路径
"LR", "20180817111111", "66"//jar中的参数,注意这里的参数写法
};
SparkSubmit.main(arg0);
}
}
四、运行结果

ps.free -m 查看机子上的内存使用率 ,注意内存不足的时候,spark界面上的任务会陷入等待。
边栏推荐
- (07) flask is OK if you have a hand -- flask Sqlalchemy
- Use redis' sorted set to make weekly hot reviews
- 开关量输入输出模块DAM-5055
- An overview of kernel compilation system
- CMD Chinese garbled code solution
- Play CSDN editor
- Detailed explanation of flask framework
- 2021-3-23-meituan-priority queue
- Chapter 8 multithreading
- Complete data summary of lapsus$apt organization that stole Microsoft's source code in March 2022
猜你喜欢

Chapter 13 IO flow
Several rounds of SQL queries in a database

20210519 leetcode double pointer

Chapter 7 exception handling
![[product] about wechat product analysis](/img/b2/e1b32e86e2c991ae5c8f8a71f692fe.png)
[product] about wechat product analysis

II. Analysis of the execution process of make menuconfig

Interviewer: how can you close an order without using a scheduled task?

Watermelon book chapter 3 (first & second)

Go replace with local code

Set接口
随机推荐
JVM memory layout detailed, illustrated, well written!
US pressure surges tiktok changes global safety director
About offline caching application cache / using manifest file caching
Fundamentals of mathematics 01
Solution: can not issue executeupdate() or executelargeupdate() for selections
12 pictures, take you to thoroughly understand ZGC garbage collector!
Detailed explanation of deeplab series (simple and practical annual summary)
After Party A's hard work, 49.08 million orders of China Mobile were scrapped
20210520 TCP sliding window
I/o instance operation
20210419 combined sum
详述jdbc查询方法执行过程
Finally, I was ranked first in the content ranking in the professional field. I haven't been tired in vain during this period. Thanks to CSDN's official platform, I'm lucky and bitter.
20210512 recursive formula
2021-4-7-find the maximum water holding capacity
The bank's face recognition system was broken: a depositor was stolen 430000 yuan
POJ1611_ The Suspects
POJ1988_ Cube Stacking
最强分布式锁工具:Redisson
[product] about wechat product analysis