当前位置:网站首页>融合数据库生态:利用 EventBridge 构建 CDC 应用
融合数据库生态:利用 EventBridge 构建 CDC 应用
2022-07-28 18:48:00 【InfoQ】
引言
CDC 概述
基本原理与应用场景

基于阿里云的 CDC 解决方案:DTS

CDC 在EventBrige上的应用


创建源为 DTS 的 EventBridge 事件流
- 前期准备
- 开通 EventBridge 服务;
- 创建 DTS 数据订阅任务;
- 创建用于消费订阅数据的消费组账号信息。
- 创建事件流
- 登陆 EventBridge 控制台,点击左侧导航栏,选择“事件流”,在事件流列表页点击“创建事件流”;
- “基本信息”中“事件流名称”与“描述”按照需要填写即可;
- 在创建事件流,选择事件提供方时,下拉框选择“数据库 DTS”;
- 在“数据订阅任务”一栏中选择已创建的 DTS 数据订阅任务。在消费组一栏,选择要使用哪个消费组消费订阅数据,同时填写消费组密码与初始消费时间。

- 事件流规则与目标按照需要填写,保存启动即可创建以 DTS 数据订阅为事件源的事件流。

注意事项
- EventBridge 使用的是 SUBSCRIBE 消费模式[8],所以请保证当前 DTS 消费组没有其他客户端实例在运行。如果设置的消费组在之前有运行,则传入的位点失效,会基于此消费组上次消费过的位点继续消费;
- 创建 DTS 事件源时传入的位点仅在新消费组第一次运行时起效,后续任务重启后会基于上次消费位点继续消费;
- EventBridge 事件流订阅 OperationType 为 INSERT、DELETE、UPDATE、DDL 类型的 DTS 数据;
- 使用 DTS 事件源可能会有消息重复,即保证消息不丢,但无法保证仅投递一次,建议用户做好幂等处理;
最佳实践示例
基于EventBridge 实现 CQRS
- 命令模型操作数据库进行变更,查询模型读取 elasticsearch 获取数据;
- 开启 DTS 数据订阅任务,捕获 DB 变更内容;
- FC 中的服务即为更新 elasticsearch 数据操作。

微服务解耦
- 用户下单/付款,订单系统进行业务处理,将数据变更写入 DB;
- 新建 DTS 订阅任务捕获 DB 数据变更;
- 搭建 EventBridge 事件流。事件提供方为 DTS 数据订阅任务,事件接收方为 RocketMQ;
- 在消费 RocketMQ 数据时,同一个 topic 下启用 3 个 group 代表不同的业务消费逻辑;

数据库备份&异构数据库同步
- 新建 DTS 数据订阅任务,捕获用户 MySQL 数据库变更;
- 搭建 EventBridge 事件流,事件提供方为 DTS 数据订阅任务;
- 使用 EventBridge 在目的数据库执行指定 sql,实现数据库备份;
- 数据变更事件投递到函数计算,用户业务根据数据变化内容更新对应异构数据库。

自建 SQL 审计
- 新建 DTS 数据订阅任务,捕获数据库变更;
- 搭建 EventBridge 事件流,事件提供方为 DTS,事件接收方为日志服务 SLS;
- 用户需要对 SQL 进行审计时,通过查询 SLS 进行。

总结

边栏推荐
- JS picture hanging style photo wall JS special effect
- 【1331. 数组序号转换】
- Voice controlled robot based on ROS (II): implementation of upper computer
- Pl515 SOT23-5 single / Dual Port USB charging protocol port controller Parkson electronic agent
- How do we do full link grayscale on the database?
- Nocturnal simulator settings agent cannot be saved
- 动态规划:背包问题模板代码汇总
- FPGA programming experience
- Redis入门一:Redis实战读书笔记
- Raspberry pie 4B uses MNN to deploy yolov5 Lite
猜你喜欢

Subcontracting loading of wechat applet

H5 wechat shooting game source code
Database tuning - connection pool optimization

Want to draw a picture that belongs to you? AI painting, you can also

Unity gadget displays the file size of the resource directory

Unity typewriter teaches you three ways

Nat experiment demonstration (Huawei switch equipment configuration)

EasyNLP中文文图生成模型带你秒变艺术家

Seventeen year operation and maintenance veterans, ten thousand words long, speak through the code of excellent maintenance and low cost~

Unity package exe to read and write excel table files
随机推荐
Redis 3.0源码分析-数据结构与对象 SDS LIST DICT
Linxu [permission, sticky bit]
The product power is greatly improved, and the new Ford Explorer is released
High beam software has obtained Alibaba cloud product ecological integration certification, and is working with Alibaba cloud to build new cooperation
Network layer performance test
太空射击第10课: Score (繪畫和文字)
Prize essay solicitation | 2022 cloud native programming challenge draft activity opens
一文读懂Okaleido Tiger近期动态,挖掘背后价值与潜力
[complete collection of common ADB commands and their usage (from a comprehensive summary of [wake up on Sunday)]
Ask if you don't understand, and quickly become an advanced player of container service!
Read the recent trends of okaleido tiger and tap the value and potential behind it
LVM logical volume
Yum package management
到底为什么不建议使用SELECT * ?
Clock distribution of jesd204 IP core (ultrascale Series)
About the title of linking to other pages
Mongoose condition queries the data of a certain time period
Explain rigid body and collider components in unity
瀚高数据库最佳实践配置工具HG_BP日志采集内容
[1331. Array serial number conversion]