数据质量监控平台是一个面向大数据场景的自动化质量保障系统,支持离线任务调度与实时流数据质量校验。通过灵活的规则配置,对 HDFS 文件或 Kafka 消息进行空值、唯一性、范围等校验,并提供任务执行追踪、多维度告警、实时指标监控等能力,帮助数据团队快速发现并定位数据质量问题。
- 操作系统:Ubuntu 20.04 / CentOS 7 (本项目基于三节点虚拟机集群部署)
- JDK:17
- Node.js:18.x
- Maven:3.8+
- Hadoop:3.2.4(HDFS/YARN)
- Spark:3.1.3
- Kafka:3.2.0
- MySQL:8.0
- Redis:5.0.7
- HBase:2.4.11
| 模块 | 技术 | 版本 |
|---|---|---|
| 前端 | React | 18.2 |
| Vite | 4.5 | |
| Ant Design | 5.15 | |
| ECharts | 5.5 | |
| Axios | 1.6 | |
| 后端 | Spring Boot | 3.2.4 |
| MySQL | 8.0 | |
| Quartz | 2.3.2 | |
| 实时计算 | Spark Structured Streaming | 3.1.3 |
| Kafka | 3.2.0 | |
| 存储 | Redis | 5.0.7 |
| HBase | 2.4.11 |
graph TD
subgraph 前端
A[React 应用] -->|API 请求| B[后端 Spring Boot]
end
subgraph 后端
B --> C[(MySQL: 规则/任务/离线告警)]
B --> D[(Redis: 实时指标)]
B --> E[(HBase: 实时告警)]
end
subgraph 实时流处理
F[Kafka: user_clicks] --> G[Spark Structured Streaming]
G --> D
G --> E
G -->|触发钉钉告警| H[钉钉机器人]
end
subgraph 离线批处理
I[HDFS 数据源] --> J[Spark 离线作业]
J --> C
B -->|调度| J
end
subgraph 外部系统
K[钉钉] --> H
end
style A fill:#e1f5fe,stroke:#01579b
style B fill:#fff9c4,stroke:#f57f17
style C fill:#c8e6c9,stroke:#1b5e20
style D fill:#ffe0b2,stroke:#bf360c
style E fill:#ffccbc,stroke:#bf360c
style F fill:#e1bee7,stroke:#4a148c
style G fill:#d1c4e9,stroke:#311b92
style I fill:#b3e5fc,stroke:#0277bd
style J fill:#b2ebf2,stroke:#006064
style H fill:#ffcdd2,stroke:#b71c1c
- 前端:提供规则管理、任务实例、告警记录、实时监控看板。
- 后端:提供 REST API,管理规则元数据、任务实例和离线告警,通过 Quartz 调度离线 Spark 作业。
- 实时计算:Spark Structured Streaming 消费 Kafka 消息,按窗口聚合指标,写入 Redis 和 HBase。
- 数据存储:
- MySQL:规则、任务实例、离线告警。
- Redis:实时窗口指标(Hash 结构)。
- HBase:实时告警明细。
- 最近7天任务趋势图(总数、成功、失败)
- 各规则通过率柱状图(颜色分级)
- 规则的增删改查
- 支持 HDFS/Kafka 数据源
- 规则类型:NULL_CHECK、UNIQUE_CHECK、RANGE_CHECK、SQL_EXPRESSION
- 手动触发规则(立即执行一次)
- 展示所有离线任务执行记录
- 按规则 ID 筛选
- 查看任务详情(执行结果摘要、错误信息)
- 离线告警:由离线任务触发,支持确认操作
- 实时告警:由 Spark Streaming 直接写入 HBase,实时展示
- 实时异常率趋势图(最近20个窗口,每条规则一条线)
- 当前异常率表格(异常率颜色标识)
- 5秒轮询最新指标
文件:backend/src/main/resources/application.yml
主要项(已用占位符替换):
spring:
datasource:
url: jdbc:mysql://node1:3306/quality
username: your_mysql_username
password: your_mysql_password
redis:
host: node1
password: your_redis_password
hbase:
zookeeper:
quorum: node2,node3
kafka:
bootstrap-servers: node2:9092
dingtalk:
webhook: https://oapi.dingtalk.com/robot/send?access_token=your_token文件:frontend/.env
VITE_API_BASE_URL=/api # 开发环境代理到后端
代理配置在 frontend/vite.config.js 中默认指向 http://node1:2006。
文件:spark-streaming-quality-job/src/main/resources/application.conf
kafka.brokers = "node2:9092"
hbase.zookeeper.quorum = "node2,node3"
redis.host = "node1"
cd backend
mvn clean package
java -jar target/quality-platform.jarcd frontend
npm install
npm run dev
# 访问 http://localhost:2005(需先启动 Kafka、HBase、Redis)
cd spark-streaming-quality-job
mvn clean package
spark-submit --class com.quality.streaming.StreamingApp \
--master yarn \
--deploy-mode cluster \
target/spark-streaming-quality-job-1.0.0.jar手动触发示例:
curl -X POST http://node1:2006/api/rules/trigger/{ruleId}.
├── backend # Spring Boot 后端
│ ├── src/main/java # 源代码
│ └── pom.xml
├── frontend # React 前端
│ ├── src
│ ├── index.html
│ ├── package.json
│ └── vite.config.js
├── spark-quality-job # 离线 Spark 作业
│ ├── src
│ └── pom.xml
└── spark-streaming-quality-job # 实时 Spark Streaming 作业
├── src
└── pom.xml
截图文件放置在 docs/ 目录下:
| 文件名 | 说明 |
|---|---|
dashboard.png |
数据看板页面 |
rules.png |
规则管理页面 |
tasks.png |
任务实例页面 |
alerts.png |
告警记录页面(离线+实时) |
realtime.png |
实时监控页面 |