Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add content to connector chapter and final chapter. Include figures in initial chapters. #19

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion doc/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ subtrees:
- file: ch-state-checkpoint/savepoint
- file: ch-state-checkpoint/state
- file: ch-state-checkpoint/exercise-state
- file: ch-flink-connectors/index
entries:
- file: ch-flink-connectors/Exactly-Once-guarantee
- file: ch-flink-connectors/custom-source-and-sink
- file: ch-flink-connectors/flink-connector
- file: ch-flink-connectors/exercise-stock-price-data-stream
- file: ch-table-sql/index
entries:
- file: ch-table-sql/table-overview
Expand All @@ -53,4 +59,12 @@ subtrees:
- file: ch-table-sql/sql-ddl
- file: ch-table-sql/system-function
- file: ch-table-sql/catalog-function
- file: ch-table-sql/exercise-iot
- file: ch-table-sql/exercise-iot
- file: ch-deployment-and-configuration/index
entries:
- file: ch-deployment-and-configuration/flink-deployment-and-configuration
- file: ch-deployment-and-configuration/configuration-file
- file: ch-deployment-and-configuration/operator-chaining-and-slot-sharing
- file: ch-deployment-and-configuration/flink-command-line-interface-guide
- file: ch-deployment-and-configuration/hadoop-flink
- file: ch-deployment-and-configuration/experiment-job-coding-packaging-and-submission
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

在大数据的5个“V”中我们已经提到,数据量大且产生速度快。从时间维度来讲,数据源源不断地产生,形成一个无界的数据流(Unbounded Data Stream)。如图1-5所示,单条数据被称为事件(Event),事件按照时序排列会形成一个数据流。例如,我们每时每刻的运动数据都会累积到手机传感器上,金融交易随时随地都在发生,物联网(Internet of Things,IoT)传感器会持续监控并生成数据。

![图1-5 数据和数据流](./img/)
![图1-5 数据和数据流](./img/data-and-data-stream.png)

数据流中的某段有界数据流(Bounded Data Stream)可以组成一个数据集。我们通常所说的对某份数据进行分析,指的是对某个数据集进行分析。随着数据的产生速度越来越快,数据源越来越多,人们对时效性的重视程度越来越高,如何处理数据流成了大家更为关注的问题。

Expand Down Expand Up @@ -35,7 +35,7 @@

处理流数据一般使用“生产者-消费者”(Producer-Consumer)模型来解决问题。如图1-6所示,生产者生成数据,将数据发送到一个缓存区域(Buffer),消费者从缓存区域中消费数据。这里我们暂且不关心生产者如何生产数据,以及数据如何缓存,我们只关心如何实现消费者。

![图1-6 生产者-消费者模型](./img/)
![图1-6 生产者-消费者模型](./img/producer-consumer.png)

在股票交易的场景中,我们可以启动一个进程来实现消费者,该进程以10秒为一个时间窗口,统计时间窗口内的交易情况,找到波动最大的那些股票。同时,该进程也对新流入的媒体文本进行分析。这个逻辑看起来很容易实现,但深挖之后会发现问题繁多。

Expand Down
2 changes: 1 addition & 1 deletion doc/ch-big-data-intro/bigdata.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

大数据,顾名思义,就是拥有庞大体量的数据。关于什么是大数据、如何定义大数据、如何使用大数据等一系列问题,拥有不同领域背景的读者的理解各不相同。通常,业界将大数据的特点归纳为图1-1所示的5个“V”。

![图1-1 大数据的5个"V"](./img/)
![图1-1 大数据的5个"V"](./img/5V.png)

- **Volume**:指数据量大。数据量单位从TB(1 024 GB)、PB(1 024 TB)、EB(1 024 PB)、ZB(1 024 EB)甚至到YB(1 024 ZB)。纽约证券交易所每天产生的交易数据大约在TB级,瑞士日内瓦附近的大型强子对撞机每年产生的数据约为PB级,而目前全球数据总量已经在ZB级,相当于1 000 000 PB。基于更大规模的数据,我们可以对某个研究对象的历史、现状和未来有更加全面的了解。
- **Velocity**:指数据产生速度快。数据要求的处理速度更快和时效性更强,因为时间就是金钱。金融市场的交易数据必须以秒级的速度进行处理,搜索和推荐引擎需要以分钟级速度将实时新闻推送给用户。更快的数据处理速度可让我们基于最新的数据做出更加实时的决策。
Expand Down
Binary file added doc/ch-big-data-intro/img/5V.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/ch-big-data-intro/img/hadoop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/ch-big-data-intro/img/spark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions doc/ch-big-data-intro/representative-big-data-technologies.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Hadoop生态圈的核心组件主要有如下3个。
- **Kafka**:Kafka是一款流处理框架,主要用作消息队列。
- **ZooKeeper**:Hadoop生态圈中很多组件使用动物来命名,形成了一个大型“动物园”,ZooKeeper是这个动物园的管理者,主要负责分布式环境的协调。

![图1-7 Hadoop生态圈](./img/)
![图1-7 Hadoop生态圈](./img/hadoop.png)

## 1.3.2 Spark

Expand All @@ -35,11 +35,11 @@ Spark的核心在于计算,主要目的在于优化Hadoop MapReduce计算部

Spark并不能完全取代Hadoop,实际上,从图1-7可以看出,Spark融入了Hadoop生态圈,成为其中的重要一员。一个Spark任务很可能依赖HDFS上的数据,向YARN申请计算资源,将结果输出到HBase上。当然,Spark也可以不用依赖这些组件,独立地完成计算。

![图1-8 Spark生态圈](./img/)
![图1-8 Spark生态圈](./img/spark.png)

Spark主要面向批处理需求,因其优异的性能和易用的接口,Spark已经是批处理界绝对的“王者”。Spark的子模块Spark Streaming提供了流处理的功能,它的流处理主要基于mini-batch的思想。如图1-9所示,Spark Streaming将输入数据流切分成多个批次,每个批次使用批处理的方式进行计算。因此,Spark是一款集批处理和流处理于一体的处理框架。

![图1-9 Spark Streaming mini-batch处理](./img/)
![图1-9 Spark Streaming mini-batch处理](./img/spark-streaming-mini-batch.png)

## 1.3.3 Apache Kafka

Expand All @@ -49,7 +49,7 @@ Kafka也是一种面向大数据领域的消息队列框架。在大数据生态

如图1-10所示,企业中不同的应用系统作为数据生产者会产生大量数据流,这些数据流还需要进入不同的数据消费者,Kafka起到数据集成和系统解耦的作用。系统解耦是让某个应用系统专注于一个目标,以降低整个系统的维护难度。在实践上,一个企业经常拆分出很多不同的应用系统,系统之间需要建立数据流管道(Stream Pipeline)。假如没有Kafka的消息队列,M个生产者和N个消费者之间要建立M×N个点对点的数据流管道,Kafka就像一个中介,让数据管道的个数变为M+N,大大减小了数据流管道的复杂程度。

![图1-10 Kafka可以连接多个应用系统](./img/)
![图1-10 Kafka可以连接多个应用系统](./img/kafka.png)

从批处理和流处理的角度来讲,数据流经Kafka后会持续不断地写入HDFS,积累一段时间后可提供给后续的批处理任务,同时数据流也可以直接流入Flink,被用于流处理。

Expand Down
Loading
Loading