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

ops/2024/10/21 19:35:48/

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/ops/6064.html

相关文章

【网络编程】web服务器shttpd源码剖析——命令行和文件配置解析

hello !大家好呀! 欢迎大家来到我的网络编程系列之web服务器shttpd源码剖析——命令行解析,在这篇文章中,你将会学习到在Linux内核中如何创建一个自己的并发服务器shttpd,并且我会给出源码进行剖析,以及手绘…

26、Lua 学习笔记之四(Lua中的基本函数库)

Lua中的基本函数库 assert(v[,mess age])collectgarbage (opt [, arg])dofile (filename)error (message [, level])_G全局环境表(全局变量)getfenv(f)getmetatable(object)ipairs (t)load (func [, chunkname])loadfile ([filename])loadstring (string [, chunkname])next (t…

简单杂项(图片)

目录 杂项其一文件类型识别 Hex-------十六进制 文件合并 文件隐写 图片隐写 杂项其一文件类型识别 Hex-------十六进制 文件分离: Binwalk: 分析文件:binwalk 文件名 分离文件:binwalk -e 文件名 foremost 文件名 -o 输出…

Rust 语言 GUI 用户界面框架汇总(持续更新)

拜登:“一切非 Rust 项目均为非法”😎 什么是 GUI 图形用户界面(Graphical User Interface,简称 GUI,又称图形用户接口)是指采用图形方式显示的计算机操作用户界面。 现在的应用开发,是既要功…

求不同字符个数(C语言)

一、N-S流程图&#xff1b; 二、运行结果&#xff1b; 三、源代码&#xff1b; # define _CRT_SECURE_NO_WARNINGS # include <stdio.h>int main() {//初始化变量值&#xff1b;char c 0;int a 0, k 0, n 0, q 0;//提示用户&#xff1b;printf("请输入一段话:…

C语言学习/复习26

一、习题讲解 1.原反补码&#xff1a; 正整数原反补码一致&#xff0c;负数反码为符号位不变其余取反&#xff0c;补码为反码加1 2.无符号字符型在内存中的运算 注意事项1&#xff1a;无符号(0~255)与有符号字符型(-128~127)的范围 注意事项2&#xff1a;无符号与有符号的整型…

使用Python实现时间序列预测模型

时间序列预测是一种重要的数据分析技术&#xff0c;它可以帮助我们预测未来的趋势和模式。在本文中&#xff0c;我们将介绍时间序列预测的基本原理和常见的预测模型&#xff0c;并使用Python来实现这些模型。 什么是时间序列预测&#xff1f; 时间序列预测是根据过去的观测数…

【Nginx】MACOS 安装与部署

安装 【前景提要】 1.本文需要使用 Homebrew&#xff0c;没有的建议先安装一下&#xff0c;很好用 国内下载有不可抗力&#xff0c;想要快速下载可以参考这里 2.进入 Terminal&#xff08;终端/黑窗口&#xff09;&#xff0c;输入以下指令&#xff1a; brew install nginx我…