← Back to Hub ← 返回主页

Week 4: Distributed Data Processing (Part 1) 第 4 周:分布式数据处理(第一部分)

Core Concepts 核心概念

1. Centralized vs. Distributed Processing (3.1)

  • Centralized Processing: All applications and data operations are executed on a single host computer (mainframe). Users connect via dumb terminals. Advantage: High security and central management. Disadvantage: Single point of failure; if the mainframe fails, the whole system drops.
  • Distributed Data Processing (DDP): Workloads and databases are split and shared among multiple independent computers (nodes) linked by a network. Advantage: High reliability and local responsiveness. If one node fails, others continue normally. Disadvantage: Data synchronization complexity.

2. Topologies & Distributed Data Models (3.2 - 3.3)

DDP can follow hierarchical layouts or peer-to-peer designs. Databases use two main strategies:

  • Replication: Multiple nodes store identical copies of the database (fast local reads, but sync writes are slow).
  • Partitioning: Databases are split horizontally (rows) or vertically (columns) so node segments hold only what they need.

1. 集中式与分布式处理 (3.1)

  • 集中式处理 (Centralized Processing):所有应用程序和数据操作都在单个主机(大型机)上执行。用户通过哑终端连接。优点:安全度高、集中管理。缺点:单点故障;如果主机崩溃,整个系统将瘫痪。
  • 分布式数据处理 (DDP):工作负载和数据库在通过网络连接的多台独立计算机(节点)之间拆分和共享。优点:可靠性高、本地响应快。如果一个节点故障,其他节点正常运行。缺点:数据同步复杂。

2. 拓扑结构与分布式数据模型 (3.2 - 3.3)

DDP 可以采用分层布局或对等设计。数据库使用两种主要策略:

  • 数据库复制 (Replication):多个节点存储数据库的相同副本(本地读取快,但同步写入较慢)。
  • 数据库分区 (Partitioning):数据库被水平(行)或垂直(列)拆分,因此各个节点仅保留其所需的数据段。

Concept Visualization: Master-Slave Database Replication 概念可视化:主从数据库复制

This animation demonstrates a centralized Master Database syncing data updates to two regional Slave Databases in real-time. This increases read performance and local survivability.

此动画展示了中央主数据库实时将数据更新同步到两个区域从数据库。这提高了读取性能和本地生存能力。

Master DB Slave DB (East) Slave DB (West)

Tips 提示

  • Horizontal Partitioning (Sharding): Divides table rows across different nodes (e.g., customers from East Region stored in East Server).
  • Vertical Partitioning: Divides table columns across nodes (e.g., product pricing stored in Sales Server, inventory count in Warehousing Server).
  • 水平分区(分片):跨不同节点划分表行(例如,来自东部地区的客户存储在东部服务器中)。
  • 垂直分区:跨不同节点划分表列(例如,销售服务器中存储的产品价格,仓储服务器中存储的库存数量)。

Practical Exercises & Step-by-Step Guide 实践练习与分步指南

Exercise 1: Distributed Network Simulation - Routing Redundancy 练习 1:分布式网络模拟 - 路由冗余性

Steps to complete:

  1. Open Cisco Packet Tracer. Place three 2911 Routers (named HQ, BranchA, BranchB) in a triangle layout.
  2. Equip routers with serial cards: Double-click each router -> turn off power -> drag HWIC-2T into empty slot -> turn power back on.
  3. Connect routers using Serial DCE cables (red cable with clock). ConnectHQ Serial 0/0/0 to BranchA Serial 0/0/0, HQ Serial 0/0/1 to BranchB Serial 0/0/0, and BranchA Serial 0/0/1 to BranchB Serial 0/0/1.
  4. Configure IPs on interfaces (e.g., HQ-BranchA link: 192.168.1.1/30 and 192.168.1.2/30).
  5. Configure OSPF on all routers. This routing protocol calculates paths dynamically and automatically reroutes traffic if a serial link is disabled.

完成步骤:

  1. 打开 Cisco Packet Tracer。在工作区呈三角形放置三台 2911 路由器(分别命名为 HQ、BranchA、BranchB)。
  2. 为路由器配置串行网卡:双击每台路由器 -> 关闭电源 -> 将 HWIC-2T 网卡拖入空插槽 -> 重新打开电源。
  3. 使用 Serial DCE 红色时钟线连接它们:HQ Serial 0/0/0 连 BranchA Serial 0/0/0;HQ Serial 0/0/1 连 BranchB Serial 0/0/0;BranchA Serial 0/0/1 连 BranchB Serial 0/0/1。
  4. 在串行接口上配置 IP(例如,HQ-BranchA 链路使用 192.168.1.1/30 与 192.168.1.2/30)。
  5. 在三台路由器上启动并配置 OSPF。该动态路由协议将自动计算最佳路径,在某条链路断开时自动切换备用路径。

Exercise 2: Design Distributed Database Topologies 练习 2:设计分布式数据库拓扑

Task: Using Draw.io, map out an Active-Passive database replication topology (where writes go only to the master node and passives are read-only) vs an Active-Active multi-master database replication topology (where any node can accept writes, requiring conflict resolution).

任务:使用 Draw.io 绘制主动-被动数据库复制拓扑(其中写操作仅分配给主节点,被动节点为只读)与主动-主动多主数据库复制拓扑(其中任何节点都可以接受写操作,需要冲突解决)。

Self-Check Practice Questions 自测练习题

1. Identify the primary benefit of Distributed Data Processing. 识别分布式数据处理 (DDP) 的主要益处。

2. Describe a key characteristic of centralized processing. 描述集中式处理的一个关键特征。

3. Explain how distributed databases improve data access speeds. 解释分布式数据库如何提高数据访问速度。

4. Recognize the main disadvantage of distributed processing systems. 识分布点处理系统的主要缺点。

5. Identify which system processes all network data on a single main server. 识别哪种系统在单个主服务器上处理所有网络数据。

6. Describe a major benefit of distributed databases over centralized storage. 描述分布式数据库相比于集中式存储的一个主要优势。

7. Explain how distributed data processing improves company scalability. 解释分布式数据处理如何提高企业可扩展性。

8. Recognize a security challenge of distributed database architectures. 识别分布式数据库架构的一个安全性挑战。

Review Questions 复习问答题

Q1. Identify the main characteristics of Distributed Data Processing (DDP) and describe one operational advantage it offers to businesses.

Q2. Explain the differences between centralized data processing and distributed data processing systems.

Vocabulary Matching Game 词汇配对游戏

Match the DDP concept on the left with its definition on the right. (Click a term, then click its matching definition). 将左侧的 DDP 概念与右侧的定义进行配对。(点击术语,然后点击匹配的定义)。

Database Replication
Horizontal Partitioning
Vertical Partitioning
OSPF Routing
Centralized Processing
Splitting table columns across different database servers 跨不同的数据库服务器拆分表中的列
Storing identical copies of the database across multiple physical sites 在多个物理站点上存储数据库的相同副本
Single central mainframe executes all calculations for dumb terminals 单个中央大型机执行哑终端的所有计算
Dynamic path selection based on real-time link states 基于实时链路状态的动态路径选择
Splitting table rows across different nodes (e.g., regional servers) 在不同的节点(例如区域服务器)之间拆分表中的行