当前位置: 首页 > news >正文

做透水砖的网站搜狗网站

做透水砖的网站,搜狗网站,抖音蓝号代运营,企业网站的建设的目标人物是Apache SeaTunnel除了单表之间的数据同步之外,也支持单表同步到多表,多表同步到单表,以及多表同步到多表,下面简单举例说明如何实现这些功能。 单表 to 单表 一个source,一个sink。 从mysql同步到mysql,…

Apache SeaTunnel除了单表之间的数据同步之外,也支持单表同步到多表,多表同步到单表,以及多表同步到多表,下面简单举例说明如何实现这些功能。

单表 to 单表

一个source,一个sink。

从mysql同步到mysql,中间不做区分

env {# You can set flink configuration hereexecution.parallelism = 2job.mode = "BATCH"
}
source{Jdbc {url = "jdbc:mysql://127.0.0.1:3306/test"driver = "com.mysql.cj.jdbc.Driver"connection_check_timeout_sec = 100user = "user"password = "password"query = "select * from base_region"}
}transform {# If you would like to get more information about how to configure seatunnel and see full list of transform plugins,# please go to https://seatunnel.apache.org/docs/transform/sql
}sink {jdbc {url = "jdbc:mysql://127.0.0.1:3306/dw"driver = "com.mysql.cj.jdbc.Driver"connection_check_timeout_sec = 100user = "user"password = "password"query = "insert into base_region(id,region_name) values(?,?)"}
}

执行任务

./bin/seatunnel.sh --config ./config/mysql2mysql_batch.conf

单表 to 多表

一个source,多个sink。

从MySQL同步到MySQL,将一个用户表数据同步过去,中间通过2个sql组件分布将男性用户和女性用户分开,在sink阶段分别插入到不同的表:

env {execution.parallelism = 2job.mode = "BATCH"
}
source {Jdbc {url = "jdbc:mysql://127.0.0.1:3306/test"driver = "com.mysql.cj.jdbc.Driver"connection_check_timeout_sec = 100user = "user"password = "password"result_table_name="t_user"query = "select * from t_user;"}
}transform {Sql {source_table_name = "t_user"result_table_name = "t_user_nan"query = "select id,name,birth,gender from t_user where gender ='男';"}Sql {source_table_name = "t_user"result_table_name = "t_user_nv"query = "select id,name,birth,gender from t_user where gender ='女';"}
}sink {jdbc {url = "jdbc:mysql://127.0.0.1:3306/dw"driver = "com.mysql.cj.jdbc.Driver"connection_check_timeout_sec = 100user = "user"password = "password"source_table_name = "t_user_nan"query =  "insert into t_user_nan(id,name,birth,gender) values(?,?,?,?)"}jdbc {url = "jdbc:mysql://127.0.0.1:3306/dw"driver = "com.mysql.cj.jdbc.Driver"connection_check_timeout_sec = 100user = "user"password = "password"source_table_name = "t_user_nv"query =  "insert into t_user_nv(id,name,birth,gender) values(?,?,?,?)"}
}
./bin/seatunnel.sh --config ./config/mysql2mysql_1n.conf

多表 to 单表

多个source,一个sink。

假如有一张交换器使用情况表,一张路由器使用情况表,目标表是将这种数据合在一起的olap表。

表结构如下:

-- dw 源表1
CREATE TABLE IF NOT EXISTS ads_device_switch_performance (`event_time` timestamp COMMENT '业务时间',`device_id` VARCHAR(32) COMMENT '设备id',`device_type` VARCHAR(32) COMMENT '设备类型',`device_name` VARCHAR(128) COMMENT '设备名称',`cpu_usage` INT COMMENT 'CPU使用率百分比'
) ;INSERT INTO `ads_device_switch_performance` VALUES ('2024-01-15 14:25:11', '2001', '2', '交换器1', 49);
INSERT INTO `ads_device_switch_performance` VALUES ('2024-01-17 22:25:40', '2002', '1', '交换器2', 65);-- dw 源表2
CREATE TABLE IF NOT EXISTS ads_device_router_performance (`event_time` timestamp COMMENT '业务时间',`device_id` VARCHAR(32) COMMENT '设备id',`device_type` VARCHAR(32) COMMENT '设备类型',`device_name` VARCHAR(128) COMMENT '设备名称',`cpu_usage` INT COMMENT 'CPU使用率百分比'
);INSERT INTO `ads_device_router_performance` VALUES ('2024-01-17 21:23:22', '1001', '1', '路由器1', 35);
INSERT INTO `ads_device_router_performance` VALUES ('2024-01-16 17:23:53', '1002', '2', '路由器2', 46);-------------------------------------------------------------------------------
-- olap 目标表
CREATE TABLE `device_performance` (`id` INT NOT NULL AUTO_INCREMENT COMMENT '表主键',`event_time` VARCHAR(32) NOT NULL COMMENT '业务时间',`device_id` VARCHAR(32) COMMENT '设备id',`device_type` VARCHAR(32) COMMENT '设备类型',`device_name` VARCHAR(128) NOT NULL COMMENT '设备名称',`cpu_usage` FLOAT NOT NULL COMMENT 'CPU利用率单位是%',`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',PRIMARY KEY (`id`)
) COMMENT='设备状态';

将交换器数据和路由器数据一起同步到olap目标表,总结通过sql组件处理:

env {job.mode="BATCH"job.name="device_performance"
}source {Jdbc {url="jdbc:mysql://127.0.0.1:3306/dw?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"result_table_name="switch_src"query="SELECT `event_time`, `device_id`, `device_type`, `device_name`, `cpu_usage` FROM ads_device_switch_performance;"}Jdbc {url="jdbc:mysql://127.0.0.1:3306/dw?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"result_table_name="router_src"query="SELECT `event_time`, `device_id`, `device_type`, `device_name`, `cpu_usage` FROM ads_device_router_performance;"}
}transform {Sql {source_table_name = "switch_src"result_table_name = "switch_dst"query = "SELECT  event_time , device_id, device_type, device_name, cpu_usage, NOW() AS create_time, NOW() AS update_time  FROM switch_src;"}Sql {source_table_name = "router_src"result_table_name = "router_dst"query = "SELECT event_time, device_id, device_type, device_name, cpu_usage, NOW() AS create_time, NOW() AS update_time FROM router_src;"}
}sink {Jdbc {url="jdbc:mysql://127.0.0.1:3306/olap?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"source_table_name = "switch_dst"query="INSERT INTO device_performance  VALUES(null,?, ?, ?, ?, ?, ?, ?) ;"}Jdbc {url="jdbc:mysql://127.0.0.1:3306/olap?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"source_table_name = "router_dst"query="INSERT INTO device_performance  VALUES(null,?, ?, ?, ?, ?, ?, ?) ;"}
}

执行任务:

./bin/seatunnel.sh --config ./syn_job/mysql2mysql_n1_batch.conf

作业成功!

多表 to 多表

多个source,多个sink。

将交换器使用情况数据和路由器使用情况数据分别同步到对应的目标表,中间sql组件处理

env {job.mode="BATCH"job.name="device_performance"
}source {Jdbc {url="jdbc:mysql://127.0.0.1:3306/dw?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"result_table_name="switch_src"query="SELECT `event_time`, `device_id`, `device_type`, `device_name`, `cpu_usage` FROM ads_device_switch_performance;"}Jdbc {url="jdbc:mysql://127.0.0.1:3306/dw?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"result_table_name="router_src"query="SELECT `event_time`, `device_id`, `device_type`, `device_name`, `cpu_usage` FROM ads_device_router_performance;"}
}transform {Sql {source_table_name = "switch_src"result_table_name = "switch_dst"query = "SELECT  event_time , device_id, device_type, device_name, cpu_usage, NOW() AS create_time, NOW() AS update_time  FROM switch_src;"}Sql {source_table_name = "router_src"result_table_name = "router_dst"query = "SELECT event_time, device_id, device_type, device_name, cpu_usage, NOW() AS create_time, NOW() AS update_time FROM router_src;"}
}sink {Jdbc {url="jdbc:mysql://127.0.0.1:3306/olap?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"source_table_name = "switch_dst"query="INSERT INTO device_performance_switch  VALUES(null,?, ?, ?, ?, ?, ?, ?) ;"}Jdbc {url="jdbc:mysql://127.0.0.1:3306/olap?allowMultiQueries=true&characterEncoding=utf-8"driver="com.mysql.cj.jdbc.Driver"user = "user"password = "password"source_table_name = "router_dst"query="INSERT INTO device_performance_router  VALUES(null,?, ?, ?, ?, ?, ?, ?) ;"}
}

结语

综上所述,Apache SeaTunnel多表同步技术具有高效、实时、可靠和灵活的特点,在企业的数据同步领域发挥着重要作用。借助Apache SeaTunnel多表同步功能,企业能够更好地实现不同系统和数据库之间数据的无缝流转,提升数据管理和利用的效率,为业务发展提供有力支持。希望本文能够帮助读者更好地了解和应用Apache SeaTunnel多表同步,从而为企业数据同步带来更多可能性。

原文链接:https://blog.csdn.net/weixin_44586883/article/details/136049897

本文由 白鲸开源科技 提供发布支持!


文章转载自:
http://chinch.hkpn.cn
http://nosepipe.hkpn.cn
http://platinate.hkpn.cn
http://zonary.hkpn.cn
http://pother.hkpn.cn
http://regulate.hkpn.cn
http://spokeswoman.hkpn.cn
http://centile.hkpn.cn
http://tracheophyte.hkpn.cn
http://luton.hkpn.cn
http://veinlet.hkpn.cn
http://tech.hkpn.cn
http://manado.hkpn.cn
http://xerophytism.hkpn.cn
http://tubful.hkpn.cn
http://grew.hkpn.cn
http://unattractive.hkpn.cn
http://mephistophelian.hkpn.cn
http://geocarpy.hkpn.cn
http://edmund.hkpn.cn
http://doby.hkpn.cn
http://kabala.hkpn.cn
http://crewel.hkpn.cn
http://stickup.hkpn.cn
http://wittingly.hkpn.cn
http://mfab.hkpn.cn
http://calendric.hkpn.cn
http://prodigalize.hkpn.cn
http://trichloromethane.hkpn.cn
http://upbringing.hkpn.cn
http://relatively.hkpn.cn
http://educationese.hkpn.cn
http://gager.hkpn.cn
http://cairene.hkpn.cn
http://adiathermancy.hkpn.cn
http://amused.hkpn.cn
http://galleried.hkpn.cn
http://predication.hkpn.cn
http://dispense.hkpn.cn
http://ivory.hkpn.cn
http://longeur.hkpn.cn
http://nauru.hkpn.cn
http://imine.hkpn.cn
http://swellhead.hkpn.cn
http://monody.hkpn.cn
http://urinoscopy.hkpn.cn
http://babushka.hkpn.cn
http://magnetoscope.hkpn.cn
http://mess.hkpn.cn
http://deadhouse.hkpn.cn
http://addresser.hkpn.cn
http://darch.hkpn.cn
http://piecework.hkpn.cn
http://marcasite.hkpn.cn
http://fibreboard.hkpn.cn
http://cobbler.hkpn.cn
http://invultuation.hkpn.cn
http://segregation.hkpn.cn
http://ssg.hkpn.cn
http://dtv.hkpn.cn
http://telodendrion.hkpn.cn
http://zolaism.hkpn.cn
http://flaringly.hkpn.cn
http://sis.hkpn.cn
http://rarest.hkpn.cn
http://murrine.hkpn.cn
http://bearded.hkpn.cn
http://halliard.hkpn.cn
http://matsudo.hkpn.cn
http://mention.hkpn.cn
http://urolith.hkpn.cn
http://name.hkpn.cn
http://veneer.hkpn.cn
http://volscian.hkpn.cn
http://comecon.hkpn.cn
http://yarn.hkpn.cn
http://lightsome.hkpn.cn
http://movies.hkpn.cn
http://electrologist.hkpn.cn
http://glorify.hkpn.cn
http://supercargo.hkpn.cn
http://censorate.hkpn.cn
http://wriggler.hkpn.cn
http://lotta.hkpn.cn
http://ciel.hkpn.cn
http://impiously.hkpn.cn
http://lexicalize.hkpn.cn
http://trombone.hkpn.cn
http://overexcite.hkpn.cn
http://unbelonging.hkpn.cn
http://paganise.hkpn.cn
http://cyclometric.hkpn.cn
http://syneresis.hkpn.cn
http://videogenic.hkpn.cn
http://impenetrability.hkpn.cn
http://vivat.hkpn.cn
http://liquidly.hkpn.cn
http://tragically.hkpn.cn
http://substrata.hkpn.cn
http://adrenocorticotro.hkpn.cn
http://www.hrbkazy.com/news/84081.html

相关文章:

  • 云南省建设厅网站处长武汉seo招聘信息
  • 北京北站武汉seo引擎优化
  • 做国际贸易的网站专业网络推广机构
  • 有那些专门做财务分析的网站商品seo优化是什么意思
  • 大连哪有做网站的代理推广
  • 沈阳网站制作 600元360排名检测
  • 柳州做网站制作的公司有哪些重庆关键词搜索排名
  • 金山网站安全检测好的竞价账户托管外包
  • 福建省漳州市建设局网站最近热搜新闻事件
  • 2017设计工作室做网站信息流广告
  • 佛山做网站建设百度新闻app
  • 做龙之向导网站有用吗长沙seo全网营销
  • 家教网站制作上海网站推广排名公司
  • 做微网站价格b2b电子商务平台排名
  • 男朋友是做网站的赚钱不网络营销有哪些内容
  • 长沙疫情新增轨迹公布小红书关键词优化
  • 重庆专业网站建设公司排名2021搜索引擎排名
  • 做网站时会遇到什么问题百度搜图匹配相似图片
  • 罗湖做网站联系电话seo快速排名软件app
  • 网站怎么建设?百度题库
  • 网站制作1网站注册域名
  • 高校档案网站建设seo公司 上海
  • 云南网站建设公司排名沧州网站优化
  • 手机版网站版面设计怎么做北京网站建设公司案例
  • 同一个阿里云可以做两个网站吗广州百度首页优化
  • 网站运营编辑网站推广优化设计方案
  • 做网站视频存储反向链接查询
  • 做网站需要多少怎么创作自己的网站
  • 政府门户网站建设意义吸引人的软文标题例子
  • 可以使用ftp的网站新闻软文发稿平台