linux上运行spark程序
来源:互联网 发布:海信液晶电视连接网络 编辑:程序博客网 时间:2024/06/06 06:53
参考官网
spark-submit
在spark安装目录的bin目录下有一个spark-submit脚本,可以用来提交运行spark程序
如果配置了spark的path可以直接使用spark-submit命令
编译构建spark程序
使用sbt 或者maven构建程序生成jar包
spark-submit的使用
spark-submit \ --class <main-class> \ --master <master-url> \ --deploy-mode <deploy-mode> \ --conf <key>=<value> \ ... # other options <application-jar> \ [application-arguments]
--class: 要运行的jar包里的类,比如 test.spark.examples
--master: master的地址 比如 spark://23.195.26.187:7077
--deploy-mode: 部署模式
--conf: 运行时的一些配置 “key=value”类型
application-jar: 要运行的jar包路径,可以是hdfs:// 开头或者 file:// 开头。比如:/root/program/spark/test.jar
application-arguments: 要传给运行类主方法的参数,没有可以不传
例子
# 本地运行,使用8个核心,传入参数100./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master local[8] \ /path/to/examples.jar \ 100# Run on a Spark standalone cluster in client deploy mode./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master spark://207.184.161.138:7077 \ --executor-memory 20G \ --total-executor-cores 100 \ /path/to/examples.jar \ 1000# Run on a Spark standalone cluster in cluster deploy mode with supervise./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master spark://207.184.161.138:7077 \ --deploy-mode cluster \ --supervise \ --executor-memory 20G \ --total-executor-cores 100 \ /path/to/examples.jar \ 1000# Run on a YARN clusterexport HADOOP_CONF_DIR=XXX./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master yarn \ --deploy-mode cluster \ # can be client for client mode --executor-memory 20G \ --num-executors 50 \ /path/to/examples.jar \ 1000# Run a Python application on a Spark standalone cluster./bin/spark-submit \ --master spark://207.184.161.138:7077 \ examples/src/main/python/pi.py \ 1000# Run on a Mesos cluster in cluster deploy mode with supervise./bin/spark-submit \ --class org.apache.spark.examples.SparkPi \ --master mesos://207.184.161.138:7077 \ --deploy-mode cluster \ --supervise \ --executor-memory 20G \ --total-executor-cores 100 \ http://path/to/examples.jar \ 1000
例子:
程序:
路径:
/root/worspace/test-1.0.jar
命令:
spark-submit --class SparkSQLExample --master local /root/worspace/test-1.0.jar
结果:
部分输出如下
17/10/09 17:58:20 INFO DAGScheduler: ResultStage 9 (show at SparkSQLExample.scala:104) finished in 0.027 s17/10/09 17:58:20 INFO DAGScheduler: Job 7 finished: show at SparkSQLExample.scala:104, took 0.044894 s+--------------------+----+-------+| _corrupt_record| age| name|+--------------------+----+-------+| null|null|Michael|| null| 30| Andy|| null| 19| Justin||spark-submit --cl...|null| null|| 100|null| null|+--------------------+----+-------+
阅读全文
0 0
- linux上运行spark程序
- eclipse上运行spark程序
- eclipse上运行spark程序
- 在linux上,用scalac编译在Spark平台上运行的scala程序
- Spark在Yarn上运行Wordcount程序
- spark集群上运行helloworld程序--WordCount
- 在spark上运行独立程序(Self-Contained Applications)
- 在基于Yarn的集群上运行Spark程序
- 编写Spark程序并提交到集群上运行
- spark集群搭建与集群上运行wordcount程序
- 运行Spark程序
- spark程序运行缓慢
- Android串口终端上运行Linux程序
- Linux服务器上运行perl程序
- 让java程序在linux上运行
- linux上运行java程序 jar格式
- linux上电自动运行运用程序
- 第一次在Linux上运行Java程序
- Defining Base and Derived Classes
- Qt-Quit
- Centos6.5服务器配置nginx的https证书(yum 安装的nginx)
- JDBC连接的封装函数
- 自适应笔记1
- linux上运行spark程序
- 哇,终于弄好了,快速部署Tale博客系统
- EasyUI进阶:一、如何在Dialog中显示iframe内容
- 用Java提交poj的细节问题
- 【Luogu3041】视频游戏的连击(AC自动机,动态规划)
- 51nod 1459 迷宫游戏 【djstl】
- Web前端优雅的显示网络请求进度条
- JSP内置对象
- iOS 用本地文件保存自定义模型