(版本定制)第12课:Spark Streaming源码解读之Executor容错安全性
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,本期内容:1、Executor的WAL容错机制2、消息重放Executor的安全容错主要是数据的安全容错,那为什么不考虑数据计算的安全容错呢?原因是计算的时候Spark Streaming是借助于Sp
千家信息网最后更新 2026年10月31日(版本定制)第12课:Spark Streaming源码解读之Executor容错安全性
本期内容:
1、Executor的WAL容错机制
2、消息重放
Executor的安全容错主要是数据的安全容错,那为什么不考虑数据计算的安全容错呢?
原因是计算的时候Spark Streaming是借助于Spark Core上RDD的安全容错的,所以天然的安全可靠的。
Executor的安全容错主要有:
1、数据副本:
有两种方式:a.借助底层的BlockManager,BlockManager做备份,通过传入的StorageLevel进行备份。
b. WAL方式进行容错。
2、接受到数据之后,不做副本,但是数据源支持存放,所谓存放就是可以反复的读取源数据。
容错的弊端:耗时间、耗空间。
简单的看下源代码:
/** Store block and report it to driver */def pushAndReportBlock( receivedBlock: ReceivedBlock,metadataOption: Option[Any],blockIdOption: Option[StreamBlockId] ) {val blockId = blockIdOption.getOrElse(nextBlockId)val time = System.currentTimeMillisval blockStoreResult = receivedBlockHandler.storeBlock(blockId, receivedBlock) logDebug(s"Pushed block $blockId in ${(System.currentTimeMillis - time)} ms")val numRecords = blockStoreResult.numRecordsval blockInfo = ReceivedBlockInfo(streamId, numRecords, metadataOption, blockStoreResult)trackerEndpoint.askWithRetry[Boolean](AddBlock(blockInfo)) logDebug(s"Reported block $blockId")}privateval receivedBlockHandler: ReceivedBlockHandler = {if (WriteAheadLogUtils.enableReceiverLog(env.conf)) {if (checkpointDirOption.isEmpty) {throw new SparkException("Cannot enable receiver write-ahead log without checkpoint directory set. " +"Please use streamingContext.checkpoint() to set the checkpoint directory. " +"See documentation for more details.") }new WriteAheadLogBasedBlockHandler(env.blockManager, receiver.streamId,receiver.storageLevel, env.conf, hadoopConf, checkpointDirOption.get) //通过WAL容错 } else {new BlockManagerBasedBlockHandler(env.blockManager, receiver.storageLevel) //通过BlockManager进行容错 }}def storeBlock(blockId: StreamBlockId, block: ReceivedBlock): ReceivedBlockStoreResult = {var numRecords = None: Option[Long]val putResult: Seq[(BlockId, BlockStatus)] = block match {case ArrayBufferBlock(arrayBuffer) => numRecords = Some(arrayBuffer.size.toLong) blockManager.putIterator(blockId, arrayBuffer.iterator, storageLevel,tellMaster = true)case IteratorBlock(iterator) =>val countIterator = new CountingIterator(iterator)val putResult = blockManager.putIterator(blockId, countIterator, storageLevel,tellMaster = true) numRecords = countIterator.count putResultcase ByteBufferBlock(byteBuffer) => blockManager.putBytes(blockId, byteBuffer, storageLevel, tellMaster = true)case o =>throw new SparkException(s"Could not store $blockId to block manager, unexpected block type ${o.getClass.getName}") }if (!putResult.map { _._1 }.contains(blockId)) {throw new SparkException(s"Could not store $blockId to block manager with storage level $storageLevel") }BlockManagerBasedStoreResult(blockId, numRecords)}简单流程图:
参考博客:http://blog.csdn.net/hanburgud/article/details/51471089
容错
安全
数据
副本
备份
方式
内容
博客
原因
天然
就是
底层
弊端
数据源
时候
机制
流程
流程图
消息
源代码
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网加科技
互联网佳科技有限公司
互联网科技有限公司经营范围
互联网通讯科技
互联网扶贫科技
互联网金融 科技
上海互联网科技有限公司
猪兼强互联网科技
互联网 的科技创新
奇酷互联网络科技
银优互联网科技有限公司
融势互联网科技
重庆科技学院互联网
天速互联网络科技有限公司
互联网校园科技培训
互联网金融中的现代科技
上海宁丞科技互联网
玉溪互联网科技怎么选
济南小医互联网科技有限公司招聘
易租星互联网科技有限公司
互联网高科技
蓝思科技飞鸽互联网
顺玮阁互联网科技
汉立互联网科技有限公司联系电话
新兴科技互联网创新大赛颁奖典礼
互联网科技扶贫时间
想开互联网科技公司怎么样
互联网科技资金流入
浙南科技城互联网大厦招聘
半导体是互联网高科技吗