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

embedded/2024/9/26 3:21:12/

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/embedded/6187.html

相关文章

分析ORACLE批量更新中的ORA-00911错误:MyBatis <foreach> 场景与解决方案

分析ORACLE批量更新中的ORA-00911错误:MyBatis 场景与解决方案 引言场景一:非法字符与SQL语句构建场景二:SQL语句结构问题场景三:嵌套参数问题与defaultParameterMap总结 引言 在日常的Java开发过程中,尤其是当我们在使…

网红泡泡机单片机方案开发定制

酷得(i-coder)是一家专业的技术服务公司,致力于为各类智能硬件提供高效、稳定、安全的底层驱动解决方案。我们拥有一支经验丰富、技术精湛的团队,能够为客户提供全方位的底层驱动开发服务。 下面是酷得的开发流程: 1…

docker方式 部署jenkins服务,实现持续集成(CI/CD)功能

一、背景: 因公司需求,需要部署一套jenkins自动化部署服务,并且是通过docker容器的方式部署的。 二、jenkins简介: 什么是Jenkins ? Jenkins是一个开源软件,是基于Java开发的一种持续集成工具,用…

HarmonyOS开发实例:【分布式数据服务】

介绍 分布式数据服务(Distributed Data Service,DDS)为应用程序提供不同设备间数据分布式的能力。通过调用分布式数据接口,应用程序将数据保存到分布式数据库中。通过结合帐号、应用和分布式数据服务对属于不同的应用的数据进行隔离,保证不同…

iOS 开发中上传 IPA 文件的方法(无需 Mac 电脑)

引言 在 iOS 开发中,将 IPA 文件上传到苹果开发者中心是一个重要的步骤。通常情况下,我们需要使用 Mac 电脑上的 Xcode 或 Application Loader 工具来完成这个任务。然而,如果你没有 Mac 电脑,也没有关系,本文将介绍一…

桌面软件使用到的开源库

想了解一下桌面软件开发中可能使用到的dll库 联想锁屏 libcef-常用概念-框架特点-CSDN博客 libcurl库使用详情、libcurl库的制作-CSDN博客 使用Cef和Qt做一个跨平台的多标签多窗口浏览器_cef3 多个标签-CSDN博客 cef 依赖的文件 libcef - Bigben - 博客园 (cnblogs.com) Q…

js 函数节流和函数防抖及区别详解

文章目录 1. 前言2. 函数节流3. 函数防抖4. 总结 1. 前言 浏览器中总是有一些操作非常耗费性能。所以就有了函数节流和函数防抖来提高浏览器性能。 函数节流:频繁触发一个事件时候,每隔一段时间,函数只会执行一次。 函数防抖:当触…

【Arduino IDE 环境配置】

目录 Arduino IDE 环境配置 1. 安装方式2. 操作方法(Arduino中文社区) 2.1. 安装Arduino IDE2.2. 下载固件2.3. 修改Arduino IDE语言2.4. 添加开发板管理网址2.5. 运行离线包2.6. 检查安装是否成功 下载Arduino IDE: 如果你还没有安装Arduin…