MySQL到Doris的StreamingETL实现(Flink CDC 3.0)

server/2024/9/23 14:35:21/

MySQL到Doris的StreamingETL实现(Flink CDC 3.0)

1 环境准备

1)安装FlinkCDC

[root@hadoop1 software]$ tar -zxvf flink-cdc-3.0.0-bin.tar.gz -C /opt/module/

2)拖入MySQL以及Doris依赖包

flink-cdc-pipeline-connector-doris-3.0.0.jar以及flink-cdc-pipeline-connector-mysql-3.0.0.jar防止在FlinkCDC的lib目录下

2 同步变更

2)编写MySQL到Doris的同步变更配置文件

在FlinkCDC目录下创建job文件夹,并在该目录下创建同步变更配置文件

[root@hadoop1 flink-cdc-3.0.0]$ mkdir job/[root@hadoop1 flink-cdc-3.0.0]$ cd job[root@hadoop1 job]$ vim mysql-to-doris.yamlsource:type: mysqlhostname: hadoop3port: 3306username: rootpassword: "123456"tables: test.\.server-id: 5400-5404server-time-zone: UTC+8sink:type: dorisfenodes: hadoop1:7030username: rootpassword: "123456"table.create.properties.light_schema_change: truetable.create.properties.replication_num: 1pipeline:name: Sync MySQL Database to Dorisparallelism: 1

3)启动任务并测试

(1)开启Flink集群,注意:在Flink配置信息中打开CheckPoint

[root@hadoop3 flink-1.18.0]$ vim conf/flink-conf.yaml

添加如下配置信息

execution.checkpointing.interval: 5000

分发该文件至其他Flink机器并启动Flink集群

[root@hadoop3 flink-1.18.0]$ bin/start-cluster.sh

(2)开启Doris FE

[root@hadoop1 fe]$ bin/start_fe.sh

(3)开启Doris BE

[root@hadoop1 be]$ bin/start_be.sh

(4)在Doris中创建test数据库

[root@hadoop3 doris]$ mysql -uroot -p123456 -P9030 -hhadoop1mysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor.  Commands end with ; or g.Your MySQL connection id is 0Server version: 5.7.99 Doris version doris-1.2.4-1-UnknownCopyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.mysql> create database test;Query OK, 1 row affected (0.00 sec)mysql> create database doris_test_route;Query OK, 1 row affected (0.00 sec)

(5)启动FlinkCDC同步变更任务

[root@hadoop3 flink-cdc-3.0.0]$ bin/flink-cdc.sh job/mysql-to-doris.yaml

(6)刷新Doris中test数据库观察结果

(7)在MySQL的test数据中对应的几张表进行新增、修改数据以及新增列操作,并刷新Doris中test数据库观察结果

3 路由变更

1)编写MySQL到Doris的路由变更配置文件

source:type: mysqlhostname: hadoop3port: 3306username: rootpassword: "123456"tables: test_route.\.server-id: 5400-5404server-time-zone: UTC+8sink:type: dorisfenodes: hadoop1:7030benodes: hadoop1:7040username: rootpassword: "123456"table.create.properties.light_schema_change: truetable.create.properties.replication_num: 1route:- source-table: test_route.t1sink-table: doris_test_route.doris_t1- source-table: test_route.t2sink-table: doris_test_route.doris_t1- source-table: test_route.t3sink-table: doris_test_route.doris_t3pipeline:name: Sync MySQL Database to Dorisparallelism: 1

2)启动任务并测试

[root@hadoop3 flink-cdc-3.0.0]$ bin/flink-cdc.sh job/mysql-to-doris-route.yaml

3)刷新Doris中test_route数据库观察结果

4)在MySQL的test_route数据中对应的几张表进行新增、修改数据操作,并刷新Doris中doris_test_route数据库观察结果


http://www.ppmy.cn/server/6183.html

相关文章

5.1激光雷达跟随(冰达机器人)

5.1激光雷达跟随功能开发 5.1.1激光雷达跟随功能需求分析 在完成激光雷达跟踪之前,我们先来拆解一下功能。要实现跟随,首先需要确定跟随的目标,在这个例程中,我们使机器人根据离它最近的物体。周围物体的距离可以通过激光雷达测量…

python基础语法+爬虫+图像处理+NumpyPandas数据处理(12天速成,第7天上-爬虫Scrapy)

爬虫(Scrapy):写一段程序代码(网络访问),自动获取网页(网络)上的数据服务端语言:网络编程,都可以作为爬虫java c c python 等均可写爬虫程序js不是一个典型的服务端程序&…

线上研讨会 | 新一代数字化技术赋能机器人及智能产线行业高质量发展

随着智能制造的快速推进,制造业转型升级到了关键阶段。在此背景下,全球各主要经济体积极围绕以工业机器人为主的智能制造业展开激烈竞争。作为打造从“制造”到“智造”的关键基础设施,工业机器人扮演者愈加重要的角色。我国作为工业机器人的…

【2024】深度学习配置环境常见报错,持续更新中....

No such file or directory: ‘:/usr/local/cuda-10.1:/usr/local/cuda-10.1/bin/nvcc‘: 确保CUDA正常后,直接运行以下代码: export CUDA_HOME/usr/local/cuda详细原因参照,安装mmcv-full时报错:Could not build wheels for mm…

TensorFlow 的基本概念和使用场景

TensorFlow 的基本概念和使用场景 TensorFlow 是一个开源的机器学习框架,由 Google 的 Google Brain 团队开发。它广泛用于数据科学、机器学习、深度学习和其他相关领域。以下是一篇关于 TensorFlow 的基本概念和使用场景的概述文章。 1. TensorFlow 简介 Tensor…

在PostgreSQL中如何实现分区表以提高查询效率和管理大型表?

文章目录 解决方案1. 确定分区键2. 创建分区表3. 数据插入与查询4. 维护与管理 示例代码1. 创建父表和子表2. 插入数据3. 查询数据 总结 随着数据量的增长,单一的大型表可能会遇到性能瓶颈和管理难题。PostgreSQL的分区表功能允许我们将一个大型表分割成多个较小的、…

XiaodiSec day034 Learn Note 小迪渗透学习笔记

XiaodiSec day034 Learn Note 小迪渗透学习笔记 记录得比较凌乱,不尽详细 day34 黑盒审计和白盒审计 与 cms 相关 .net java php 代码审计 开始 黑盒:找文件上传的功能 个人用户中心是否存在文件上传功能后台管理系统是否存在文件上传功能字典目录…

JavaScript-4.正则表达式、BOM

正则表达式 正则表达式包含在"/","/"中 开始与结束 ^ 字符串的开始 $ 字符串的结束 例: "^The":表示所有以"The"开始的字符串("There"、"The cat"等&#x…