大数据平台学习(三)----spark核心编程

spark架构原理

 

原理图:

 创建RDD

 一是使用程序中的集合创建RDD,主要用于进行测试,可以实际部署到集群运行之前,

自己使用集合构造测试数据,来测试后面的spark应用的流程;

二是使用本地文件创建RDD,主要用于的场景为在本地临时性地处理一些存储了大量数据的文件;

三是使用HDFS文件创建RDD,主要用于针对HDFS上存储的大数据,进行离线批处理操作

 

 

操作RDD

转化操作:

 

 

行为操作:

 

RDD持久化

为什么要执行RDD持久化?

 

 RDD持久化策略是什么?

 

Spark内核源码深度剖析

原理图:

 

 宽依赖和窄依赖

 

基于yarn的两种提交模式

 

 

 sparkcontext原理剖析

 

master原理剖析与源码分析

 

资源调度机制十分重要(两种资源调度机制)

主备切换机制原理图:

注册机制原理图:

 

master资源调度算法原理:

master是通过schedule方法进行资源调度,告知worker启动executor,,,

1,schedule方法

2,startExecutorOnWorkers在woker上开启executor进程

3,  scheduleExecutorsOnWorker在每一个worker上调度资源

判断该worker能否分配一个或者多个executor,能则分配相应的executor所需要的CPU核数;

4,  allocateWorkerResourceToExecutor在worker上分配的具体资源

五、launchDriver发起driver

 

六、launchExecutor发起executor

 

worker原理剖析:

 

 job触发流程原理剖析:

其实最终是调用了SparkContext之前初始化时创建的DAGSchdule的runjob方法;

 

 DAGSchdule原理剖析:

注:reduceByKey的作用就是对相同key的数据进行处理,最终每个key只保留一条记录;

        其作用对象是(key, value)形式的RDD;

 

 Taskschedule原理分析

 

 注:本地化级别种类:

PROCESS_LOCAL:进程本地化,rdd和partition和task在同一个executor中;

NODE_LOCAL:rdd的parttion和task,不在一个同一个executor中,但在同一个节点中;

NO_PREF:没有本地化级别;

RACK_LOCAL:机架本地化,至少rdd的parttion和task在一盒机架中;

ANY:任意本地化级别;

 

Executor原理剖析与源码分析

1、work为application启动的executor,实际上是启动了CoarseGrainedExecutorBackend进程;

 

2、获取driver的actor,向driver发送RegisterExecutor信息

 

3、dirver注册executor成功之后,会发送RegisteredExecutor信息

(此时CoarseGrainedExecutorBackend会创建Executor执行句柄,大部分功能都是通过Executor实现的)

 

4、启动task,反序列化task,调用Executor执行器的launchTask()启动一个task;

 

5、对每个task都会创建一个TaskRunner,将TaskRunner放入内存缓存中;

(将task封装在一个线程TaskRunner),将线程丢入线程池中,然后执行线程池是自动实现了排队机制的

 

 

 Task原理剖析

1、task是封装在一个线程中(taskRunner)

 

2、调用run(),对序列化的task数据进行反序列化,然后通过通络通信,将需要的文件,资源,jar文件拷贝过来,

通过反序列化操作,调用updateDependencies() 将整个Task数据反序列化回来;

 1 <span style="font-size:14px;">override def run(): Unit = {
 2       val threadMXBean = ManagementFactory.getThreadMXBean
 3       val taskMemoryManager = new TaskMemoryManager(env.memoryManager, taskId)
 4       val deserializeStartTime = System.currentTimeMillis()
 5       val deserializeStartCpuTime = if (threadMXBean.isCurrentThreadCpuTimeSupported) {
 6         threadMXBean.getCurrentThreadCpuTime
 7       } else 0L
 8       Thread.currentThread.setContextClassLoader(replClassLoader)
 9       val ser = env.closureSerializer.newInstance()
10       logInfo(s"Running $taskName (TID $taskId)")
11       execBackend.statusUpdate(taskId, TaskState.RUNNING, EMPTY_BYTE_BUFFER)
12       var taskStart: Long = 0
13       var taskStartCpu: Long = 0
14       startGCTime = computeTotalGcTime()
15 
16       try {
17         //对序列化的task数据进行反序列化
18         val (taskFiles, taskJars, taskProps, taskBytes) =
19           Task.deserializeWithDependencies(serializedTask)
20 
21         // Must be set before <span style="color:#ff0000;">updateDependencies</span>() is called, in case fetching dependencies
22         // requires access to properties contained within (e.g. for access control).
23         Executor.taskDeserializationProps.set(taskProps)
24         //然后通过网络通信,将需要的文件,资源呢、jar拷贝过来
25         updateDependencies(taskFiles, taskJars)
26         //通过反序列化操作,将整个Task的数据反序列化回来
27        task = ser.deserialize[Task[Any]](taskBytes, Thread.currentThread.getContextClassLoader)
28         task.localProperties = taskProps
29         task.setTaskMemoryManager(taskMemoryManager)
30 
31         // If this task has been killed before we deserialized it, let's quit now. Otherwise,
32         // continue executing the task.
33         if (killed) {
34           // Throw an exception rather than returning, because returning within a try{} block
35           // causes a NonLocalReturnControl exception to be thrown. The NonLocalReturnControl
36           // exception will be caught by the catch block, leading to an incorrect ExceptionFailure
37           // for the task.
38           throw new TaskKilledException
39         }
40 
41         logDebug("Task " + taskId + "'s epoch is " + task.epoch)
42         env.mapOutputTracker.updateEpoch(task.epoch)
43 
44         // Run the actual task and measure its runtime.
45         //计算task的开始时间
46         taskStart = System.currentTimeMillis()
47         taskStartCpu = if (threadMXBean.isCurrentThreadCpuTimeSupported) {
48           threadMXBean.getCurrentThreadCpuTime
49         } else 0L
50         var threwException = true
51         val value = try {
52         调用task的run()
53           val res = task.run(
54             taskAttemptId = taskId,
55             attemptNumber = attemptNumber,
56             metricsSystem = env.metricsSystem)
57           threwException = false
58           res
59         } finally {
60           val releasedLocks = env.blockManager.releaseAllLocksForTask(taskId)
61           val freedMemory = taskMemoryManager.cleanUpAllAllocatedMemory()
62 
63           if (freedMemory > 0 && !threwException) {
64             val errMsg = s"Managed memory leak detected; size = $freedMemory bytes, TID = $taskId"
65             if (conf.getBoolean("spark.unsafe.exceptionOnMemoryLeak", false)) {
66               throw new SparkException(errMsg)
67             } else {
68               logWarning(errMsg)
69             }
70           }
71 
72           if (releasedLocks.nonEmpty && !threwException) {
73             val errMsg =
74               s"${releasedLocks.size} block locks were not released by TID = $taskId:\n" +
75                 releasedLocks.mkString("[", ", ", "]")
76             if (conf.getBoolean("spark.storage.exceptionOnPinLeak", false)) {
77               throw new SparkException(errMsg)
78             } else {
79               logWarning(errMsg)
80             }
81           }
82         }
83         val taskFinish = System.currentTimeMillis()
84         val taskFinishCpu = if (threadMXBean.isCurrentThreadCpuTimeSupported) {
85           threadMXBean.getCurrentThreadCpuTime
86         } else 0L
87 
88         // If the task has been killed, let's fail it.
89         if (task.killed) {
90           throw new TaskKilledException
91         }    </span>
92

 

 

 

 

3、updateDependencies() 主要是获取hadoop的配置文件,使用了java的synchronized多线程访问方式,

task是以java线程的方式,在一个CoarseGrainedExecutorBackend进程内并发运行的,因此在执行一些业务逻辑

的时候,需要访问一些共享资源,就会出现多线程并发访问的安全问题;

 1 <span style="font-size:14px;"> private def updateDependencies(newFiles: HashMap[String, Long], newJars: HashMap[String, Long]) {
 2     //获取hadoop的配置文件
 3     lazy val hadoopConf = SparkHadoopUtil.get.newConfiguration(conf)
 4     //使用了java的synchronized多线程并发访问方式
 5     //task是以java线程的方式,在一个CoarseGrainedExecutorBackend进程内并发运行的
 6     //因此在执行一些业务逻辑的时候,需要访问一些共享资源,就会出现多线程并发访问安全问题
 7     synchronized {
 8       // Fetch missing dependencies
 9       //遍历要拉取的文件
10       for ((name, timestamp) <- newFiles if currentFiles.getOrElse(name, -1L) < timestamp) {
11         logInfo("Fetching " + name + " with timestamp " + timestamp)
12         // Fetch file with useCache mode, close cache for local mode.
13         //通过Utils的fetchFile(),通过网络通信,从远程拉取文件
14        Utils.fetchFile(name, new File(SparkFiles.getRootDirectory()), conf,
15           env.securityManager, hadoopConf, timestamp, useCache = !isLocal)
16         currentFiles(name) = timestamp
17       }
18       //遍历要拉取得jar
19       for ((name, timestamp) <- newJars) {
20         val localName = name.split("/").last
21         val currentTimeStamp = currentJars.get(name)
22           .orElse(currentJars.get(localName))
23           .getOrElse(-1L)
24         if (currentTimeStamp < timestamp) {
25           logInfo("Fetching " + name + " with timestamp " + timestamp)
26           // Fetch file with useCache mode, close cache for local mode.
27           Utils.fetchFile(name, new File(SparkFiles.getRootDirectory()), conf,
28             env.securityManager, hadoopConf, timestamp, useCache = !isLocal)
29           currentJars(name) = timestamp
30           // Add it to our class loader
31           val url = new File(SparkFiles.getRootDirectory(), localName).toURI.toURL
32           if (!urlClassLoader.getURLs().contains(url)) {
33             logInfo("Adding " + url + " to class loader")
34             urlClassLoader.addURL(url)
35           }
36         }
37       }
38     }
39   }    </span>
40

 

 

 

 

 

 4、task的run方法,创建了Taskcontext,里面记录了task的一些全局性的数据,还包括task重试了几次,task属于

哪个stage,task处理的是rdd的哪个parttion,然后调用抽象方法runTask();

 1 <span style="font-size:14px;">final def run(
 2       taskAttemptId: Long,
 3       attemptNumber: Int,
 4       metricsSystem: MetricsSystem): T = {
 5     SparkEnv.get.blockManager.registerTask(taskAttemptId)
 6     //创建了Taskcontext,里面记录了task的一些全局性的数据
 7     //包括task重试了几次,task属于哪个stage,task处理的是rdd的哪个partition
 8     context = new TaskContextImpl(
 9       stageId,
10       partitionId,
11       taskAttemptId,
12       attemptNumber,
13       taskMemoryManager,
14       localProperties,
15       metricsSystem,
16       metrics)
17     TaskContext.setTaskContext(context)
18     taskThread = Thread.currentThread()
19 
20     if (_killed) {
21       kill(interruptThread = false)
22     }
23 
24     new CallerContext("TASK", appId, appAttemptId, jobId, Option(stageId), Option(stageAttemptId),
25       Option(taskAttemptId), Option(attemptNumber)).setCurrentContext()
26 
27     try {
28     //调用抽象方法runTask()
29       runTask(context)
30     } catch {
31       case e: Throwable =>
32         // Catch all errors; run task failure callbacks, and rethrow the exception.
33         try {
34           context.markTaskFailed(e)
35         } catch {
36           case t: Throwable =>
37             e.addSuppressed(t)
38         }
39         throw e
40     } finally {
41       // Call the task completion callbacks.
42       context.markTaskCompleted()
43       try {
44         Utils.tryLogNonFatalError {
45           // Release memory used by this thread for unrolling blocks
46           SparkEnv.get.blockManager.memoryStore.releaseUnrollMemoryForThisTask(MemoryMode.ON_HEAP)
47           SparkEnv.get.blockManager.memoryStore.releaseUnrollMemoryForThisTask(MemoryMode.OFF_HEAP)
48           // Notify any tasks waiting for execution memory to be freed to wake up and try to
49           // acquire memory again. This makes impossible the scenario where a task sleeps forever
50           // because there are no other tasks left to notify it. Since this is safe to do but may
51           // not be strictly necessary, we should revisit whether we can remove this in the future.
52           val memoryManager = SparkEnv.get.memoryManager
53           memoryManager.synchronized { memoryManager.notifyAll() }
54         }
55       } finally {
56         TaskContext.unset()
57       }
58     }
59   }</span>
60 

 

 

 

 

 

5、抽象方法runTask(),需要Task的子类去实现,ShuffleMapTask、ResaultTask;

1 <span style="font-size:14px;">def runTask(context: TaskContext): T</span>

 

 

 

6、一个ShuffleMapTask会将一个个Rdd元素切分为多个bucket基于在一个ShuffleDependency的中指定的partitioner,

 1 <span style="font-size:14px;">private[spark] class ShuffleMapTask(
 2     stageId: Int,
 3     stageAttemptId: Int,
 4     taskBinary: Broadcast[Array[Byte]],
 5     partition: Partition,
 6     @transient private var locs: Seq[TaskLocation],
 7     metrics: TaskMetrics,
 8     localProperties: Properties,
 9     jobId: Option[Int] = None,
10     appId: Option[String] = None,
11     appAttemptId: Option[String] = None)
12   extends Task[MapStatus](stageId, stageAttemptId, partition.index, metrics, localProperties, jobId,
13     appId, appAttemptId)
14   with Logging</span>

 

 

7、runTask有MapStatus返回值,对task要处理的数据做一些反序列化操作,然后通过广播变量拿到要处理rdd那部分

数据,获取shuffleManager,调用rdd的iterator(),并且传入了当前要执行的哪个parttion,rdd的iterator(),实现

了针对rdd的某个parttion执行我们定义的算子,之后返回的数据通过ShuffleWriter,经过Hashpartioner后,写入自己对应

bucket中,最后返回mapstatus,里面封装了计算后的数据,存储在Blockmanager中;

 

 1 <span style="font-size:14px;">override def runTask(context: TaskContext): MapStatus = {
 2     // Deserialize the RDD using the broadcast variable.
 3     val threadMXBean = ManagementFactory.getThreadMXBean
 4     val deserializeStartTime = System.currentTimeMillis()
 5     val deserializeStartCpuTime = if (threadMXBean.isCurrentThreadCpuTimeSupported) {
 6       threadMXBean.getCurrentThreadCpuTime
 7     } else 0L
 8     //对task要处理的数据做一些反序列化操作
 9     //通过广播变量拿到要处理的rdd那部分数据
10     val ser = SparkEnv.get.closureSerializer.newInstance()
11     val (rdd, dep) = ser.deserialize[(RDD[_], ShuffleDependency[_, _, _])](
12       ByteBuffer.wrap(taskBinary.value), Thread.currentThread.getContextClassLoader)
13     _executorDeserializeTime = System.currentTimeMillis() - deserializeStartTime
14     _executorDeserializeCpuTime = if (threadMXBean.isCurrentThreadCpuTimeSupported) {
15       threadMXBean.getCurrentThreadCpuTime - deserializeStartCpuTime
16     } else 0L
17 
18     var writer: ShuffleWriter[Any, Any] = null
19     try {
20     //获取shuffleManager
21       val manager = SparkEnv.get.shuffleManager
22       //从shuffleManager中获取writer
23       writer = manager.getWriter[Any, Any](dep.shuffleHandle, partitionId, context)
24         //调用了rdd的iterator(),并且传入了当前要执行的哪个partition
25      //rdd的iterator(),实现了针对rdd的某个parttion执行我们自己定义的算子
26      //执行完我们自己定义的算子,返回的数据通过ShuffleWriter,经过Hashpartioner后,写入自己对应的分区bucket中
27      writer.write(rdd.iterator(partition, context).asInstanceOf[Iterator[_ <: Product2[Any, Any]]])
28       //最后返回MapStatus,里面封装了计算后的数据,存储在Blockmanager中
29       writer.stop(success = true).get
30     } catch {
31       case e: Exception =>
32         try {
33           if (writer != null) {
34             writer.stop(success = false)
35           }
36         } catch {
37           case e: Exception =>
38             log.debug("Could not stop writer", e)
39         }
40         throw e
41     }
42   } </span>

 

 

 

 

 8、MapPartitionsRDD

针对RDD的某个partition,执行我们给定的算子或者函数;

(注:可以理解成自己定义的算子或者函数,spark对其进行了封装,这里针对rdd的parttion,执行自定义的计算

操作,并返回新的rdd的parttion的数据)

 1 <span style="font-size:14px;">private[spark] class MapPartitionsRDD[U: ClassTag, T: ClassTag](
 2     var prev: RDD[T],
 3     f: (TaskContext, Int, Iterator[T]) => Iterator[U],  // (TaskContext, partition index, iterator)
 4     preservesPartitioning: Boolean = false)
 5   extends RDD[U](prev) {
 6 
 7   override val partitioner = if (preservesPartitioning) firstParent[T].partitioner else None
 8 
 9   override def getPartitions: Array[Partition] = firstParent[T].partitions
10 //针对rdd的某个partiton,执行我们给定的算子或者函数
11   //f:可以理解成自己定义的算子或者函数,spark内部进行了封装
12   //这里针对rdd的partition,执行自定义的计算操作,并返回 新的rdd的partition的数据
13   override def compute(split: Partition, context: TaskContext): Iterator[U] =
14     f(context, split.index, firstParent[T].iterator(split, context))
15 
16   override def clearDependencies() {
17     super.clearDependencies()
18     prev = null
19   }
20 }</span>

 

 

 

 

9、statusUpdate()是个抽象方法

1 <span style="font-size:14px;">execBackend.statusUpdate(taskId, TaskState.FINISHED, serializedResult)
2  // statusUpdate
3  override def statusUpdate(taskId: Long, state: TaskState, data: ByteBuffer) {
4     val msg = StatusUpdate(executorId, taskId, state, data)
5     driver match {
6       case Some(driverRef) => driverRef.send(msg)
7       case None => logWarning(s"Drop $msg because has not yet connected to driver")
8     }
9   } </span>

 

 

 

10、调用TaskSchedulerImpl的statusUpdate(),获取对应的taskset,task结束了,从内存移除;

 

 

 1 <span style="font-size:14px;">def statusUpdate(tid: Long, state: TaskState, serializedData: ByteBuffer) {
 2     var failedExecutor: Option[String] = None
 3     var reason: Option[ExecutorLossReason] = None
 4     synchronized {
 5       try {
 6         taskIdToTaskSetManager.get(tid) match {
 7           获取对应的taskSet
 8           case Some(taskSet) =>
 9             if (state == TaskState.LOST) {
10               // TaskState.LOST is only used by the deprecated Mesos fine-grained scheduling mode,
11               // where each executor corresponds to a single task, so mark the executor as failed.
12               val execId = taskIdToExecutorId.getOrElse(tid, throw new IllegalStateException(
13                 "taskIdToTaskSetManager.contains(tid) <=> taskIdToExecutorId.contains(tid)"))
14               if (executorIdToRunningTaskIds.contains(execId)) {
15                 reason = Some(
16                   SlaveLost(s"Task $tid was lost, so marking the executor as lost as well."))
17                 removeExecutor(execId, reason.get)
18                 failedExecutor = Some(execId)
19               }
20             }
21             if (TaskState.isFinished(state)) {
22             //task结束了从内存中移除
23              cleanupTaskState(tid)
24               taskSet.removeRunningTask(tid)
25               if (state == TaskState.FINISHED) {
26                 taskResultGetter.enqueueSuccessfulTask(taskSet, tid, serializedData)
27               } else if (Set(TaskState.FAILED, TaskState.KILLED, TaskState.LOST).contains(state)) {
28                 taskResultGetter.enqueueFailedTask(taskSet, tid, state, serializedData)
29               }
30             }
31           case None =>
32             logError(
33               ("Ignoring update with state %s for TID %s because its task set is gone (this is " +
34                 "likely the result of receiving duplicate task finished status updates) or its " +
35                 "executor has been marked as failed.")
36                 .format(state, tid))
37         }
38       } catch {
39         case e: Exception => logError("Exception in statusUpdate", e)
40       }
41     }
42     // Update the DAGScheduler without holding a lock on this, since that can deadlock
43     if (failedExecutor.isDefined) {
44       assert(reason.isDefined)
45       dagScheduler.executorLost(failedExecutor.get, reason.get)
46       backend.reviveOffers()
47     }
48   } </span>

 

 普通Shuffle操作的原理剖析

 

 (注:什么是shuffle过程,它分为map中的和reduce中的

首先看map中的:

 

再看reduce端的shuffle

 

shuffle的过程:

 

优化过后的shuffle操作的原理剖析

 

 BlockManager原理剖析:

1、Diver上有BlockManagerMaster,负责对各个节点上的BlockManager内部管理的元数据进行维护;

2、每个节点的BlockManager有几个关键组件,DiskStore负责对磁盘上的数据进行读写,MemoryStore负责对内存中的数据进行读写,ConnectionManager负责建立BlockManager到远程其他节点的

BlockManager的网络连接,BlockTransferService负责对远程其他节点的BlockManager数据读写;

3、每个BlockManager创建之后,会向BlockManangerMaster进行注册,BlockManagerMaster会为其创建对应的BlockManagerInfo;

4、BlockManager进行读写时,比如RDD运行过程中的一些中间数据,或者指定的persist(),会优先将数据写入内存,如果内存大小不够,再将内存部分数据写入磁盘;

5、如果persist() 指定了要replica,那么会使用BlockTransferService将数据replica一份到其他节点的BlockManager上去;

6、BlockManager进行读操作时,就会用ConnectionManager与有数据的BlockManager建立连接,然后用BlockTransferService从远程BlockManager读写数据;

7、只要使用了BlockManager执行了数据增删改的操作,那么就必须将block的BlockStatus上报到BlockManagerInfo内部的BlockStatus进行增删改操作,从而对元数据进行维护;

 

cacheManager原理剖析:

 

 

CacheManager 源码解析 :

1、cacheManager管理的是缓存中的数据,缓存可以是基于内存的缓存,也可以是基于磁盘的缓存;

2、cacheManager需要通过BlockManager 来操作数据;

3、每当Task运行的时候回调用RDD的compute方法进行计算,而compute方法会调用iterator方法;

compute方法是final级别不能覆写但可以被子类去使用,可以看见RDD是优先使用内存的,如果存储级别

不等于NONE的情况下,程序会先找CacheManager 获得数据,否则的话会看有没有进行checkpoint;

 

 

 

 

 

 4、cache在工作的时候会最大化的保留数据,但是数据不一定绝对完整,因为当前的计算机如果需要内存空间的话,那么内存中的数据必须让出空间,这是因为执行比缓存重要,此时如何在RDD持久化的时候同时指定了可以把数据放左Disk上,那么部分cache的数据可以从内存转入磁盘,否则的话,数据就会丢失;

在进行Cache时,BlockManager会帮你进行管理,我们可以通过key到BlockManager中找出曾经缓存的数据;

 

 

 

 

 如果有BlockManager.get()方法没有返回任何数据,就调用acquireLockForPartition 方法,因为会有可能多条线程在操作数据,spark有一个东西叫慢任务StraggleTask 推迟,StraggleTask 推迟的时候一般都会运行两个任务在两台机器上;

 

 

 

 

 

 

最后还是通过 BlockManager.get 来获得数据

 

 

 5、具体cacheManager在获得缓存数据的时候会通过BlockManager 来抓到数据,优先在本地找数据或者远程抓数据;

 

 BlockManger.getLocal然后转过来调用doGetLocal方法,在doGetLocal的实现中看到缓存其实不一定在内存中,

缓存可以在存在、磁盘、也可以在offHeap(Tachyon)中;

 

 

 

 

 6、在上一步调用了getLocal方法后转过调用了doGetLocal

 

 

 

 

 

 

 

 

 

 

 

 7、在第5步中如果本地没有缓存的话,就调用getRemote方法从远程抓取数据;

 

 

 

 

 8、如果cacheManager没有通过BlockManager 获得缓存内容的话,其实会通过RDD的computeOrReadCheckpoint ()方法来获得数据;

 

 首先需要检查看当前的RDD是否进行了CheckPoint,如果进行了话就直接读取checkpoint的数据,否则的话就必需进行计算;

checkpoint本身很重要,计算之后通过putInBlockManager 会把数据按照StorageLevel 重新缓存起来;

 

 

 

 

9、如果数据缓存的空间不够,此时会调用memoryStore中的unrollSafety方法,里面有一个循环在内存中放数据;

 

 

CheckPoint原理:

 

 

原理分析:

1、SparkContext的setCheckpointDir 设置了一个checkpoint 目录

 1 def setCheckpointDir(directory: String) {
 2 
 3     // If we are running on a cluster, log a warning if the directory is local.
 4     // Otherwise, the driver may attempt to reconstruct the checkpointed RDD from
 5     // its own local file system, which is incorrect because the checkpoint files
 6     // are actually on the executor machines.
 7     if (!isLocal && Utils.nonLocalPaths(directory).isEmpty) {
 8       logWarning("Spark is not running in local mode, therefore the checkpoint directory " +
 9         s"must not be on the local filesystem. Directory '$directory' " +
10         "appears to be on the local filesystem.")
11     }
12     //利用hadoop的api创建了一个hdfs目录
13     checkpointDir = Option(directory).map { dir =>
14       val path = new Path(dir, UUID.randomUUID().toString)
15       val fs = path.getFileSystem(hadoopConfiguration)
16       fs.mkdirs(path)
17       fs.getFileStatus(path).getPath.toString
18     }
19   }

 

2、RDD核心的CheckPoint方法

def checkpoint(): Unit = RDDCheckpointData.synchronized {
    // NOTE: we use a global lock here due to complexities downstream with ensuring
    // children RDD partitions point to the correct parent partitions. In the future
    // we should revisit this consideration.
    if (context.checkpointDir.isEmpty) {
      throw new SparkException("Checkpoint directory has not been set in the SparkContext")
    } else if (checkpointData.isEmpty) {
      //创建ReliableRDDCheckpointData指向的RDDCheckpointData的实例
      checkpointData = Some(new ReliableRDDCheckpointData(this))
    }
  }

3、创建了一个ReliableRDDCheckpointData

//ReliableRDDCheckpointData 的父类RDDCheckpointData
private[spark] class ReliableRDDCheckpointData[T: ClassTag](@transient private val rdd: RDD[T])
  extends RDDCheckpointData[T](rdd) with Logging {

......

}

 

4、父类RDDCheckpointData

/**
 * RDD 需要经过
 * 
 * [ Initialized  --> CheckpointingInProgress--> Checkpointed ] 
 * 这几个阶段才能被 checkpoint
 * 
 */
private[spark] abstract class RDDCheckpointData[T: ClassTag](@transient private val rdd: RDD[T])
  extends Serializable {

  import CheckpointState._

  // The checkpoint state of the associated RDD.
  //标识CheckPoint的状态,第一次初始化时是Initialized
  protected var cpState = Initialized

......

}

 

checkpoint写入数据:

1、Spark job运行最终会调用SparkContext的runJob方法将任务提交给Executor去执行;

 def runJob[T, U: ClassTag](
      rdd: RDD[T],
      func: (TaskContext, Iterator[T]) => U,
      partitions: Seq[Int],
      resultHandler: (Int, U) => Unit): Unit = {
    if (stopped.get()) {
      throw new IllegalStateException("SparkContext has been shutdown")
    }
    val callSite = getCallSite
    val cleanedFunc = clean(func)
    logInfo("Starting job: " + callSite.shortForm)
    if (conf.getBoolean("spark.logLineage", false)) {
      logInfo("RDD's recursive dependencies:\n" + rdd.toDebugString)
    }
    dagScheduler.runJob(rdd, cleanedFunc, partitions, callSite, resultHandler, localProperties.get)
    progressBar.foreach(_.finishAll())
    //在生产环境下会调用ReliableRDDCheckpointData的doCheckpoint方法
    rdd.doCheckpoint()
  }

 

2、rdd.doCheckpoint()方法

private[spark] def doCheckpoint(): Unit = {
    RDDOperationScope.withScope(sc, "checkpoint", allowNesting = false, ignoreParent = true) {
      if (!doCheckpointCalled) {
        doCheckpointCalled = true
        if (checkpointData.isDefined) {
          if (checkpointAllMarkedAncestors) {
            // TODO We can collect all the RDDs that needs to be checkpointed, and then checkpoint
            // them in parallel.
            // Checkpoint parents first because our lineage will be truncated after we
            // checkpoint ourselves
            dependencies.foreach(_.rdd.doCheckpoint())
          }
          checkpointData.get.checkpoint()
        } else {
          //遍历依赖的rdd,调用每个rdd的doCheckpoint方法
          dependencies.foreach(_.rdd.doCheckpoint())
        }
      }
    }
  }

3、checkpointData类型是RDDCheckpointData中的doCheckpoint()方法;

 final def checkpoint(): Unit = {
    // Guard against multiple threads checkpointing the same RDD by
    // atomically flipping the state of this RDDCheckpointData
    RDDCheckpointData.synchronized {
      if (cpState == Initialized) {
        //1、标记当前状态为正在checkpoint中
        cpState = CheckpointingInProgress
      } else {
        return
      }
    }
    //2 这里调用的是子类的doCheckpoint()
    val newRDD = doCheckpoint()

    // Update our state and truncate the RDD lineage
     // 3 标记checkpoint已完成,清空RDD依赖
    RDDCheckpointData.synchronized {
      cpRDD = Some(newRDD)
      cpState = Checkpointed
      rdd.markCheckpointed()
    }
  }

 

4、子类ReliableRDDCheckpointData的doCheckpoint()方法;

 1 protected override def doCheckpoint(): CheckpointRDD[T] = {
 2     /**
 3      * 为该 rdd 生成一个新的依赖,设置该 rdd 的 parent rdd 为 CheckpointRDD
 4      * 该 CheckpointRDD 负责以后读取在文件系统上的   checkpoint 文件,生成该 rdd 的 partition
 5      */
 6     val newRDD = ReliableCheckpointRDD.writeRDDToCheckpointDirectory(rdd, cpDir)
 7 
 8     // Optionally clean our checkpoint files if the reference is out of scope
 9     // 是否清除checkpoint文件如果超出引用的资源范围
10     if (rdd.conf.getBoolean("spark.cleaner.referenceTracking.cleanCheckpoints", false)) {
11       rdd.context.cleaner.foreach { cleaner =>
12         cleaner.registerRDDCheckpointDataForCleanup(newRDD, rdd.id)
13       }
14     }
15 
16     logInfo(s"Done checkpointing RDD ${rdd.id} to $cpDir, new parent is RDD ${newRDD.id}")
17     //  将新产生的RDD返回给父类
18     newRDD
19   }

5、ReliableCheckpointRDD.writeRDDToCheckpointDirectory(rdd, cpDir)方法

 /**
   * Write RDD to checkpoint files and return a ReliableCheckpointRDD representing the RDD.
   * 
   * 触发runJob 来执行当前的RDD 中的数据写到Checkpoint 的目录中,同时会产生ReliableCheckpointRDD 实例
   */
  def writeRDDToCheckpointDirectory[T: ClassTag](
      originalRDD: RDD[T],
      checkpointDir: String,
      blockSize: Int = -1): ReliableCheckpointRDD[T] = {
    val checkpointStartTimeNs = System.nanoTime()

    val sc = originalRDD.sparkContext

    // Create the output path for the checkpoint
    //把checkpointDir设置我们checkpoint的目录
    val checkpointDirPath = new Path(checkpointDir)
    // 获取HDFS文件系统API接口
    val fs = checkpointDirPath.getFileSystem(sc.hadoopConfiguration)
    // 创建目录
    if (!fs.mkdirs(checkpointDirPath)) {
      throw new SparkException(s"Failed to create checkpoint path $checkpointDirPath")
    }

    // Save to file, and reload it as an RDD
    // 将配置文件信息广播到所有节点
    val broadcastedConf = sc.broadcast(
      new SerializableConfiguration(sc.hadoopConfiguration))
    // TODO: This is expensive because it computes the RDD again unnecessarily (SPARK-8582)
    //  核心代码
     /**
      * 此处新提交一个Job,也是对RDD进行计算,那么如果原有的RDD对结果进行了cache的话,
      * 那么是不是减少了很多的计算呢,这就是为啥checkpoint的时候强烈推荐进行cache的缘故
      */
    sc.runJob(originalRDD,
      writePartitionToCheckpointFile[T](checkpointDirPath.toString, broadcastedConf) _)

    // 如果rdd的partitioner不为空,则将partitioner写入checkpoint目录
    if (originalRDD.partitioner.nonEmpty) {
      writePartitionerToCheckpointDir(sc, originalRDD.partitioner.get, checkpointDirPath)
    }
    
    val checkpointDurationMs =
      TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - checkpointStartTimeNs)
    logInfo(s"Checkpointing took $checkpointDurationMs ms.")
    
    // 创建一个CheckpointRDD,该分区数目应该和原始的rdd的分区数是一样的
    val newRDD = new ReliableCheckpointRDD[T](
      sc, checkpointDirPath.toString, originalRDD.partitioner)
    if (newRDD.partitions.length != originalRDD.partitions.length) {
      throw new SparkException(
        "Checkpoint RDD has a different number of partitions from original RDD. Original " +
          s"RDD [ID: ${originalRDD.id}, num of partitions: ${originalRDD.partitions.length}]; " +
          s"Checkpoint RDD [ID: ${newRDD.id}, num of partitions: " +
          s"${newRDD.partitions.length}].")
    }
    newRDD
  }

 

最后,会返回新的CheckpointRDD ,父类将它复值给成员cpRDD,最终标记当前状态为Checkpointed并清空当RDD的依赖链;到此Checkpoint的数据就被序列化到HDFS上了;

 

checkpoint读出数据

 

1、RDD的iterator()

 1 /**
 2    * 先调用presist(),再调用checkpoint()
 3    * 先执行到rdd的iterator()的时候,storageLevel != StorageLevel.NONE,就会通过CacheManager获取数据
 4    * 此时发生BlockManager获取不到数据,就会第一次计算数据,在通过BlockManager进行持久化
 5    * 
 6    * rdd的job执行结束,启动单独的一个job,进行checkpoint,
 7    * 下一次又运行到rdd的iterator()方法就会发现持久化级别不为空,默认从BlockManager中读取持久化数据(正常情况下)
 8    * 
 9    * 在非正常情况下,就会调用computeOrReadCheckpoint方法,判断如果isCheckpoint为ture,
10    * 就会调用父rdd的iterator(),从外部文件系统中读取数据
11    */
12   final def iterator(split: Partition, context: TaskContext): Iterator[T] = {
13     if (storageLevel != StorageLevel.NONE) {
14       getOrCompute(split, context)
15     } else {
16       //进行RDD的partition计算
17       computeOrReadCheckpoint(split, context)
18     }
19   }

 

2、继续调用computeOrReadCheckpoint

1 private[spark] def computeOrReadCheckpoint(split: Partition, context: TaskContext): Iterator[T] =
2   {
3     if (isCheckpointedAndMaterialized) {
4       firstParent[T].iterator(split, context)
5     } else {
6       //抽象方法,找具体实现类,比如MapPartitionsRDD
7       compute(split, context)
8     }
9   }

调用rdd.iterator() 去计算rdd的partition的时候,会调用computeOrReadCheckpoint(split: Partition)去查看该rdd是否被checkPoint过了,

如果是,就调用rdd的parent rdd的iterator()也就是CheckpointRDD.iterator(),否则直接调用该RDD的compute

 

3、CheckpointRDD(ReliableCheckpointRDD)的compute

1  //Path上读取我们的CheckPoint数据
2   override def compute(split: Partition, context: TaskContext): Iterator[T] = {
3     val file = new Path(checkpointPath, ReliableCheckpointRDD.checkpointFileName(split.index))
4     ReliableCheckpointRDD.readCheckpointFile(file, broadcastedConf, context)
5   }

 

4、readCheckpointFile方法

 1  def readCheckpointFile[T](
 2       path: Path,
 3       broadcastedConf: Broadcast[SerializableConfiguration],
 4       context: TaskContext): Iterator[T] = {
 5     val env = SparkEnv.get
 6     // 用hadoop API 读取HDFS上的数据
 7     val fs = path.getFileSystem(broadcastedConf.value.value)
 8     val bufferSize = env.conf.getInt("spark.buffer.size", 65536)
 9     val fileInputStream = {
10       val fileStream = fs.open(path, bufferSize)
11       if (env.conf.get(CHECKPOINT_COMPRESS)) {
12         CompressionCodec.createCodec(env.conf).compressedInputStream(fileStream)
13       } else {
14         fileStream
15       }
16     }
17     val serializer = env.serializer.newInstance()
18     val deserializeStream = serializer.deserializeStream(fileInputStream)
19 
20     // Register an on-task-completion callback to close the input stream.
21     context.addTaskCompletionListener[Unit](context => deserializeStream.close())
22     //反序列化数据后转换为一个Iterator
23     deserializeStream.asIterator.asInstanceOf[Iterator[T]]
24   }

 

转载于:https://www.cnblogs.com/zhzJAVA11/p/10430833.html

Spark大数据平台应用实战 对于一个具有相当技术门槛与复杂度的平台,Spark从诞生到正式版本的成熟,经历的时间如此之短,让人惊诧。2009年,Spark诞生于伯克利大学AMPLab,于2010年正式开源,2013年成为了Apache基金项目,2014年成为Apache基金的较高级项目,整个过程不到五年时间。 2015年是Spark飞速发展的一年,Spark成为了现在大数据领域最火的开源软件,截止2015年,Spark的C... 阅读详情

相关推荐

大数据(Bigdata)常用技术栈

提起大数据,不得不提由IBM提出的关于大数据的5V特点:Volume(大量)、Velocity(高速)、Variety(多样)、Value(低价值密度)、Veracity(真实性),而对于大数据领域的从业人员的日常工作也与这5V密切相关。大数据技术在过去的几十年中取得非常迅速的发展,尤以Hadoop和Spark最为突出,已构建起庞大的技术生态体系圈 首先通过一张图来了解一下目前大数据领域常用的一些技术,当然大数据发展至今所涉及技术远不止这些。 BigData Stack: 下面分不同层介绍各个技术,当然各个

weixin_45417821的博客 6402

Spark Task级调度及黑名单和失败重试

Spark 在执行用户app程序时,执行Driver时会存在TaskScheduler 任务调度器属性,这个属性在伴随Driver的执行就会初始化,在StageScheduler 中 submitTask任务时,把任务提交给TaskScheduler中 TaskScheduler:Driver中的task任务调度器 在Driver执行过程中,DAGScheduler将划分的阶段Stage提交给TaskScheduler 后,TaskScheduler 将Stage 按照最后一个RDD的分区数量来划分成ta

weixin_44563670的博客 975

学习Java大数据需要掌握哪些Java技能?

学习Java大数据需要掌握哪些Java技能?现在大数据发展很速度很多小伙伴想要学习Java大数据技术开发,但是学习大数据为什么需要掌握Java技能呢? 一、学大数据为什么要掌握Java? 首先,我们学习大数据,为什么要先掌握Java技术? Java是目前使用非常广泛的编程语言,它具有的众多特性,特别适合作为大数据应用的开发语言。 Java不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的

编程领域的博客 4962

spark 2.1 TaskContext

object TaskContextobject TaskContext { /** * Return the currently active TaskContext. This can be called inside of * user functions to access contextual information about running tasks. */

houzhizhen的专栏 1602

大数据开发都需要掌握哪些编程语言

当前正处在大数据时代背景下,大数据技术目前也正处在落地应用的初期,未来大数据的发展空间还是比较大的,所以学习大数据相关技术是个不错的选择。 大数据编程语言的选择要根据具体的工作岗位来进行,目前大数据领域的工作岗位包括大数据平台研发、大数据应用开发、大数据分析和大数据运维,除了大数据平台研发之外,其他岗位的人才需求量还是比较大的,尤其是大数据分析岗位。 大数据应用开发岗位比较常见的编程...

weixin_45732629的博客 3629

h5页面调用微信JS-SDK分享到微信好友或者朋友圈的配置

1.引入js &lt;script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"&gt;&lt;/script&gt; 2.在页面添加配置 &lt;script type="text/javascript"&gt; var url = location.href..

tiantiandashi的博客 2万+

Spark加载hadoop配置原理

0x0 背景 最近为了将hadoop&hive的五大配置文件,即: core-site.xml hdfs-site.xml yarn-site.xml mapred-site.xml hive-site.xml 从项目中(classpath)移到项目外(任意位置),研究了spark启动过程的源码,在此记录一下。 0x1 Hadoop及Hive获取默认配置过程 Hadoop有一个类 Co

gx304419380的博客 5980

【免费】最新区块链钱包和私钥的助记词碰撞器,使用python开发

最新钱包私钥助记词碰撞器,搏一搏单车变摩托!

weixin_48529185的博客 1万+

【译】Spark官方文档——Spark Configuration(Spark配置)

注重版权,尊重他人劳动 转帖注明原文地址:http://www.cnblogs.com/vincent-hv/p/3316502.html Spark主要提供三种位置配置系统: 环境变量:用来启动Spark workers,可以设置在你的驱动程序或者conf/spark-env.sh 脚本中; java系统性能:可以控制内部的配置参数,两种设置方法: 编程的方式(程序中...

weixin_30791095的博客 301

硬件电路(22)-TTL和232切换电路

工作中会遇到TTL和232电平的通信的状态,为了实现一种便捷的切换方式,参考了一些文章,提供一种电路方便大家使用。

剑藏锋的博客 1879

SuperPoint+SuperGlue在HLoc中的实战效果对比:5大公开数据集测试报告

本文在HLoc框架下,对传统SIFT与深度学习组合SuperPoint+SuperGlue在五大公开数据集上的视觉定位效果进行了实战对比测试。报告详细分析了两种方案在Aachen Day-Night、RobotCar Seasons等不同光照、季节及场景下的表现,揭示了SuperPoint+SuperGlue在应对剧烈光照变化和长期外观变化时的显著优势,并提供了基于HLoc模块化设计的选型与配置策略。

weixin_29093169的博客 427

Hadoop3.2.0使用详解

1.概述 Hadoop3已经发布很久了,迭代集成的一些新特性也是很有用的。截止本篇博客书写为止,Hadoop发布了3.2.0。接下来,笔者就为大家分享一下在使用Hadoop3中遇到到一些问题,以及解决方法。 2.内容 2.1 基础软件包 在使用这些组件时,我们需要做一些准备工作,内容如下: Hadoop-3.2.0安装包(建议Hadoop-3.2.0源代码也一起下载,后面步骤需要用到...

weixin_30951743的博客 1239

小白跑WRF第五天,安装WPS和静态地理数据

小白跑WRF第四天,安装WPS一、WPS简介二、下载和安装WPSV4.0第一步、进入Build_WRF文件夹第二步、下载WPSV4.0第三步、解压WPS安装包第四步、修改intmath.f(必须执行)第五步、安装WPS三、修改namelist.wps 一、WPS简介 二、下载和安装WPSV4.0 第一步、进入Build_WRF文件夹 cd Build_WRF 第二步、下载WPSV4.0 下载WPSV4.0的安装包有以下三种方式: 利用Linux命令下载。 进入网站https://www2.mmm.uca

weixin_42372313的博客 2万+

2026年高职大数据技术核心技能与人才培养指南

大数据技术作为数字化转型的核心驱动力,其底层原理基于分布式计算和存储架构。Hadoop生态和Spark框架通过并行处理机制实现海量数据的高效运算,而数据仓库技术则为业务决策提供结构化支持。在工程实践中,掌握Java/Python编程和ETL流程是处理数据的基础,Tableau等可视化工具则能直观呈现分析结果。随着电商和金融等领域对实时分析需求的增长,推荐系统和风控模型等应用场景对技术人才提出了更高要求。调研显示,2026年大数据岗位需求将保持25%以上增速,高职教育需重点培养数据处理、平台工具和业务理解三大

weixin_42530570的博客 343

【四足机器人实战】四足机器人运动学、动力学模型

认知有限,望大家多多包涵,有什么问题也希望能够与大家多交流,共同成长!四足机器人的运动学和动力学模型是其设计和控制的基础,涉及到如何精确描述和预测机器人在不同条件下的运动状态和行为本文先对四足机器人运动学、动力学模型做个简单的介绍,具体内容后续再更,其他模块可以参考去我其他文章运动学模型主要关注四足机器人的几何形态和时间序列下的运动特性,而动力学模型则进一步考虑了引起这些运动的力和扭矩的作用效果。运动学模型:运动学模型描述了四足机器人在没有考虑力的影响下的运动特性。

qq_35635374的博客 1058

揭秘LLM如何预测下一个词

Transformer结构的大语言模型(LLM)通过自回归训练学习预测下一个词汇,其核心能力源自权重矩阵的动态优化。自注意力层的Wq/Wk/Wv矩阵捕捉语义关联,前馈网络的W1/W2矩阵进行非线性特征提取,LM Head的W_{lm}矩阵将语义映射到词汇概率。训练过程中,这些矩阵通过反向传播不断调整,最终使模型能够根据上下文(如"我"→"爱")生成合理的后续词汇。这种基于矩阵变换的数学机制是LLM智能生成文本的本质原因。(150字)

ZhangJiqun&191cm&85kg 382

【大数据平台】基于Spark的气象数据分析

1.1.研究背景在大数据时代背景下,各行业数据的规模大幅度增加,数据类别日益复杂,给数据分析工作带来极大挑战。气象行业和人们的生活息息相关,随着信息时代的发展,大数据技术的出现为气象数据的发展带来机遇。基于此,本项目使用Spark等大数据处理工具,采用机器学习、深度学习等多种数据分析方法,并借助可视化手段将多种类型数据与复杂数据进行解读与概括,探究大数据技术在气象数据中的应用,给受众传递更有价值的信息,进而有助于提升社会整体生产效率,推动市场经济的有效发展。1.2.研究方案一、选用合适的数据集。历史天气数据

m0_53700832的博客 1万+

基于QT+Halcon实现线序识别

一、线序识别算法步骤。 1.按照检测区域m_pItem1的外接矩形(rtBount)的大小, 截取感兴趣区域图像hRoi。 2.把截取出来的感兴趣区域图像hRoi, 分离出R、G、B三个通道hRed、hGreen、hBlue。 3.把hRed、hGreen、hBlue三个通道转换成cielab颜色空间, 得到hChannelL、hChannelA、hChannelB三个颜色图。 4.设m_pItem1的宽为iItemW, 高为iItemH. 分别申请大小为iItemW的pSumL、pSumA、pSumB内

专注现代C++实战,从核心语法到高性能编程,助力开发者深入掌握系统级编程精髓。 1756

大数据开发学习,大数据学习路线(完整详细版)

很多初学者,对大数据的概念都是模糊不清的,大数据是什么,能做什么,学的时候,该按照什么线路去学习,学完往哪方面发展,想深入了解,想学习的同学欢迎加入大数据学习qq群:199427210,有大量干货(零基础以及进阶的经典实战)分享给大家,并且有清华大学毕业的资深大数据讲师给大家免费授课,给大家分享目前国内最完整的大数据高端实战实用学习流程体系 在巨大的数据集中进行筛选的最好工具是什么?以下是...

juan189的博客 2万+

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

核心知识——Spark的Why&How

核心知识——Spark的Why&How:本文主要介绍了 Spark 的核心优势和常用编程语言选择,并详细讲解了 Spark 伪分布式应该如何部署运行。

从知识输入到知识输出 2457

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

BigData-Notes:全面解析大数据技术栈入门指南

BigData-Notes:全面解析大数据技术栈入门指南 本文全面解析了大数据技术生态体系,涵盖了从数据采集、存储、处理到应用的全生命周期技术栈。详细介绍了Hadoop生态系统三大核心组件(HDFS、MapReduce、YARN)的架构原理和协同工作机制,深入对比分析了主流流处理框架(Flink、Spark Streaming、Storm)与批处理框架的技术特性、性能差异和适用场景。最后提供了系统...

gitblog_00043的博客 1109

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

【大数据】Spark 小白成长手册:从入门到实践

学习 Spark 是一段充满挑战但极具价值的旅程。从了解 Spark 的基本概念和特性,到掌握其核心组件如 RDD、Dataset、Spark SQL 和 Spark Streaming,每一步都为我们打开了一扇通往大数据高效处理世界的大门。

大雨淅淅的博客 1179

【智能大数据分析 | 实验二】Spark实验:部署Spark集群

智能大数据分析实验二,Spark实验:部署Spark集群。理解Spark体系架构,学会部署Spark集群,能够配置Spark集群使用HDFS。最后在master上提交并运行Spark示例代码WordCount,上传至HDFS。

Morse_Chen的博客 5219

BigData-Notes 16.9k Star 项目解析:从 Hadoop 到 Flink 的 13 个组件学习路径

本文解析了16.9k Star的BigData-Notes开源项目,为开发者设计了一套从Hadoop到Flink的13周系统学习路径。该项目覆盖大数据生态的13个核心组件,包含理论基础、环境搭建、API使用等多元学习维度,适合中级开发者快速构建大数据知识体系。

culh2177的博客 874

大数据平台开发学习路线及技能

背景最近项目涉及这方面,特地整理学习路线方便后续学习。

yannsann的博客 1963
上一篇: 大数据平台学习(二)----spark平台搭建
下一篇: spark性能优化
bangche3676
博客等级 码龄11年 20粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值