Spark读码笔记之精简cluster运行代码
2017-01-23 15:01
393 查看
启动Master
var conf = new SparkConf() Master.startRpcEnvAndEndpoint("localhost", 60001, 60002, conf) Thread.currentThread().join()
启动Worker01
var conf = new SparkConf() Worker.startRpcEnvAndEndpoint("localhost", 61001, 61002, 2, 1024, Array("spark://localhost:60001"), "D:\\YCloud\\PRGs\\spark\\learning\\cluster\\worker01", Some(1), conf) Thread.currentThread().join()
启动Work02
var conf = new SparkConf() Worker.startRpcEnvAndEndpoint("localhost", 62001, 62002, 2, 1024, Array("spark://localhost:60001"), "D:\\YCloud\\PRGs\\spark\\learning\\cluster\\worker02", Some(2), conf) Thread.currentThread().join()
提交Job
var conf = new SparkConf() .setMaster("spark://localhost:60001") .setAppName("myApp") .set("spark.local.dir", "D:\\YCloud\\PRGs\\spark\\learning\\cluster\\context") var context = new SparkContext(conf) Thread.sleep(10000); println("end of executor") var rdd = context.makeRDD(Array(1,2,3,4)) var processPartition = {(_: Iterator[Int]) => println("OK.");0} var partitions = Array(0,1,2,3) var resultHandler = {(_: Int, _: Int) => } var resultFunc = { () => } for (_ <- 1 to 10) { context.submitJob(rdd, processPartition, partitions, resultHandler, resultFunc) Thread.sleep(2000) println("end of job") } var processPartition1 = {(_: Iterator[Int]) => var i=0L; while(true) { println(i);Thread.sleep(1000);i+=1};0} context.submitJob(rdd, processPartition1, partitions, resultHandler, resultFunc) Thread.currentThread().join()
Spark Jobs WebUI
相关文章推荐
- 《Unix网络编程卷1》笔记(1):第一章简介——使用Cygwin运行示例代码
- spark部分代码分析,修改笔记
- 第47讲:Scala多重界定代码实战及其在Spark中的应用源码解析学习笔记
- 本地开发spark代码上传spark集群服务并运行(基于spark官网文档)
- 第44讲:Scala中View Bounds代码实战及其在Spark中的应用源码解析学习笔记
- Spark学习笔记-Tachyon运行Spark
- 在集群运行spark代码记录程序
- 本地开发spark代码上传spark集群服务并运行(基于spark官网文档)
- 第43讲:Scala中类型变量Bounds代码实战及其在Spark中的应用源码解析学习笔记
- wxWidgets笔记之三--------------代码的编译与运行
- Swift学习笔记(一)搭配环境以及代码运行成功
- Spark Hadoop集群部署与Spark操作HDFS运行详解---Spark学习笔记10
- spark 笔记 3:Delay Scheduling: A Simple Technique for Achieving Locality and Fairness in Cluster Scheduling
- Spark学习笔记-如何运行wordcount(使用jar包)
- Spark 代码阅读笔记
- 在standalone-cluster模式上运行spark应用程序(用sbt打包)
- Swift学习笔记(一)搭配环境以及代码运行成功
- spark 笔记(一) stand alone 和yarn-cluster的部分区别
- 第46讲:ClassTag 、Manifest、ClassManifest、TypeTag代码实战及其在Spark中的应用源码解析学习笔记
- [Eclipse笔记]Just for fun – 在Eclipse下编译和运行C#的代码