一、

Spark Streaming 构建在Spark core API之上,具备可伸缩,高吞吐,可容错的流处理模块。

1)支持多种数据源,如Kafka,Flume,Socket,文件等;

  • Basic sources: Sources directly available in the StreamingContext API. Examples: file systems, and socket connections.
  • Advanced sources: Sources like Kafka, Flume, Kinesis, etc. are available through extra utility classes. These require linking against extra dependencies.

2)处理完成数据可写入Kafka,Hdfs,本地文件等多种地方;

DStream:

Spark Streaming对持续流入的数据有个高层的抽像:

It represents a continuous stream of data

a DStream is represented by a continuous series of RDDs,Each RDD in a DStream contains data from a certain interval

Any operation applied on a DStream translates to operations on the underlying RDDs.

什么是RDD?

RDD是Resilient Distributed Dataset的缩写,中文译为弹性分布式数据集,是Spark中最重要的概念。

RDD是只读的、分区的,可容错的数据集合。

何为弹性?

RDD可在内存、磁盘之间任意切换

RDD可以转换成其它RDD,可由其它RDD生成

RDD可存储任意类型数据

二、基本概念

1)add dependency

<dependency>

<groupId>org.apache.spark</groupId>

<artifactId>spark-streaming_2.11</artifactId>

<version>2.3.1</version>

</dependency>

其它想关依赖查询:

https://search.maven.org/search?q=g:org.apache.spark%20AND%20v:2.2.0

2)文件作为DStream源,是如何被监控的?

1)文件格式须一致

2)根据modify time开成流,而非create time

3)处理时,当前文件变更不会在此window处理,即不会reread

4)可以调用 FileSystem.setTimes()来修改文件时间,使其在下个window被处理,即使文件内容未被修改过

三、Transform operation

window operation

Spark Streaming also provides windowed computations, which allow you to apply transformations over a sliding window of data.

every time the window slides over a source DStream, the source RDDs that fall within the window are combined and operated upon to produce the RDDs of the windowed DStream.

在一个时间窗口内的RDD被合并为一个RDD来处理。

Any window operation needs to specify two parameters:

window length: The duration of the window

sliding interval: The interval at which the window operation if performed

四、Output operation

使用foreachRDD

dstream.foreachRDD is a powerful primitive that allows data to be sent out to external systems. However, it is important to understand how to use this primitive correctly and efficiently.

CheckPoint概念

Performance Tuning

Fault-tolerance Semantics

spark-streaming first insight的更多相关文章

  1. Offset Management For Apache Kafka With Apache Spark Streaming

    An ingest pattern that we commonly see being adopted at Cloudera customers is Apache Spark Streaming ...

  2. Spark踩坑记——Spark Streaming+Kafka

    [TOC] 前言 在WeTest舆情项目中,需要对每天千万级的游戏评论信息进行词频统计,在生产者一端,我们将数据按照每天的拉取时间存入了Kafka当中,而在消费者一端,我们利用了spark strea ...

  3. Spark Streaming+Kafka

    Spark Streaming+Kafka 前言 在WeTest舆情项目中,需要对每天千万级的游戏评论信息进行词频统计,在生产者一端,我们将数据按照每天的拉取时间存入了Kafka当中,而在消费者一端, ...

  4. Storm介绍及与Spark Streaming对比

    Storm介绍 Storm是由Twitter开源的分布式.高容错的实时处理系统,它的出现令持续不断的流计算变得容易,弥补了Hadoop批处理所不能满足的实时要求.Storm常用于在实时分析.在线机器学 ...

  5. flume+kafka+spark streaming整合

    1.安装好flume2.安装好kafka3.安装好spark4.流程说明: 日志文件->flume->kafka->spark streaming flume输入:文件 flume输 ...

  6. spark streaming kafka example

    // scalastyle:off println package org.apache.spark.examples.streaming import kafka.serializer.String ...

  7. Spark Streaming中动态Batch Size实现初探

    本期内容 : BatchDuration与 Process Time 动态Batch Size Spark Streaming中有很多算子,是否每一个算子都是预期中的类似线性规律的时间消耗呢? 例如: ...

  8. Spark Streaming源码解读之No Receivers彻底思考

    本期内容 : Direct Acess Kafka Spark Streaming接收数据现在支持的两种方式: 01. Receiver的方式来接收数据,及输入数据的控制 02. No Receive ...

  9. Spark Streaming架构设计和运行机制总结

    本期内容 : Spark Streaming中的架构设计和运行机制 Spark Streaming深度思考 Spark Streaming的本质就是在RDD基础之上加上Time ,由Time不断的运行 ...

  10. Spark Streaming中空RDD处理及流处理程序优雅的停止

    本期内容 : Spark Streaming中的空RDD处理 Spark Streaming程序的停止 由于Spark Streaming的每个BatchDuration都会不断的产生RDD,空RDD ...

随机推荐

  1. [NOIP 2014TG D1T3] 飞扬的小鸟

    题目描述 Flappy Bird 是一款风靡一时的休闲手机游戏.玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙.如果小鸟一不小心撞到了水管或者掉在地上的话,便 ...

  2. Oracle 12c新特性之——TABLE ACCESS BY INDEX ROWID BATCHED

    Oracle12c开始,我们在获取SQL语句的执行计划时,也会经常看到"TABLE ACCESS BY INDEX ROWID BATCHED"操作,那么,这个操作到底是什么意思呢 ...

  3. JBoss/WildFly 初步安装配置教程

    1.下载 Redhat的JBoss与Oracle的Weblogic.IBM的WebSphere并称三大JAVA EE中间件. JBoss AS是JBoss的开源版本,JBoss EAP是JBoss的企 ...

  4. 五笔xu

      1● 横 a s d f g     半包围 上下 左右   2● 竖 h j k l m 左右 上下 半包围     3● 撇 q w e r t     半包围 上下 左右 4● 捺 y u ...

  5. Vue 全家桶

    第 1 章:Vue 核心 1.1. Vue 的基本认识1.1.1. 官网1) 英文官网: https://vuejs.org/2) 中文官网: https://cn.vuejs.org/ 1.1.2. ...

  6. UVA LA 3983 - Robotruck DP,优先队列 难度: 2

    题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_pr ...

  7. .net core Asp.net Mvc Ef 网站搭建 vs2017 1)

    1)开发环境搭建 首先下载安装vs2017  地址 :https://www.visualstudio.com/zh-hans/downloads/ 安装勾选几项如下图 ,注意点在单个组件时.net ...

  8. Java反射《二》获取构造器

    package com.study.reflect; import java.lang.reflect.Constructor; import java.lang.reflect.Invocation ...

  9. InterBase 数据库与驱动 版本不同

    [Window Title] Project1 - Delphi 10.1 Berlin - Unit1 [Content] Failed: "unsupported on-disk str ...

  10. 使用STL的next_permutation函数

    文章作者:姜南(Slyar) 文章来源:Slyar Home (www.slyar.com) 转载请注明,谢谢合作. 下午研究了一下全排列算法,然后发现C++的STL有一个函数可以方便地生成全排列,这 ...