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

温州做网站哪家公司好足球世界排名国家最新

温州做网站哪家公司好,足球世界排名国家最新,免费申请qq号码免费申请注册,工程在哪个网站做推广比较合适目录 概述实践代码总结表创建插入一行数据更新一行数据删除一笔数据 概述 本文测试 canal 监控 mysql 表变化。canal 1.1.7 mysql 8.0.x 版本。 实践 代码 public static void main(String[] args) {// 创建一个 CanalConnector 连接器// username:字符串类型,Canal使用该用…

目录

  • 概述
  • 实践
    • 代码
    • 总结
      • 表创建
      • 插入一行数据
      • 更新一行数据
      • 删除一笔数据

概述

   本文测试 canal 监控 mysql 表变化。canal 1.1.7 mysql 8.0.x 版本。

实践

代码

public static void main(String[] args) {// 创建一个 CanalConnector 连接器// username:字符串类型,Canal使用该用户名验证客户端身份// password:字符串类型,Canal使用该密码验证客户端身份CanalConnector canalConnector = CanalConnectors.newSingleConnector(new InetSocketAddress("10.xx.xx.142", 11111), "example", "canal", "canal");try {while (true) {try {// 连接 Canal Server 尝试多次重连canalConnector.connect();break;} catch (Exception e) {System.out.println("重新连接...");Thread.sleep(1000);}}// 订阅数据库表,默认监听所有的数据 库、表、等同于: .*\\..*//canalConnector.subscribe(".*\\..*");// 监听指定的数据库、表canalConnector.subscribe("shop.product");// 回滚到上一次的 batchId,取消已经消费过的日志canalConnector.rollback();// 持续监听 Canal Server 推送的数据,并使用自定义的 CanalEventDownStreamHandler 处理器消费数据while (true) {// 允许指定 batchSize 一次可以获取多条  每次返回的对象为 Message  包含的内容为// batch id 唯一标识// entries 具体的数据对象Message message = canalConnector.getWithoutAck(100);long batchId = message.getId();// 如果没有新数据 则暂停固定时间后  继续获取if (batchId == -1 || message.getEntries().isEmpty()) {Thread.sleep(1000);}else {// 解析 binlog 数据输出详细信息for (CanalEntry.Entry entry : message.getEntries()) {if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN || entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {continue;}CanalEntry.RowChange rowChange = null;try {rowChange = CanalEntry.RowChange.parseFrom(entry.getStoreValue());} catch (Exception e) {e.printStackTrace();continue;}String schemaName = entry.getHeader().getSchemaName();String tableName = entry.getHeader().getTableName();CanalEntry.EventType eventType = rowChange.getEventType();System.out.println(String.format("Binlog[%s:%s] schema[%s] table[%s] eventType[%s]",entry.getHeader().getLogfileName(),entry.getHeader().getLogfileOffset(),schemaName,tableName,eventType));for (CanalEntry.RowData rowData : rowChange.getRowDatasList()) {// 根据事件类型  输出变更前、后的列数据if (eventType == CanalEntry.EventType.DELETE) {printColumn(rowData.getBeforeColumnsList());} else if (eventType == CanalEntry.EventType.INSERT) {printColumn(rowData.getAfterColumnsList());}else {System.out.println("before");printColumn(rowData.getBeforeColumnsList());System.out.println("after");printColumn(rowData.getAfterColumnsList());}}// 确认消费成功canalConnector.ack(batchId);}}}} catch (Exception e) {e.printStackTrace();}finally {canalConnector.disconnect();}}private static void printColumn(List<CanalEntry.Column> columns) {for (CanalEntry.Column column : columns) {System.out.println(column.getName()+" : "+column.getValue() +" update:"+ column.getUpdated());}}

总结

表创建

Binlog[binlog.000002:3153] schema[shop] table[product] eventType[CREATE]

插入一行数据

Binlog[binlog.000002:4484] schema[shop] table[product] eventType[INSERT]
id : 1 update:true
title : 测试 update:true
cover_img : 21 update:true
amout : 11.0 update:true
summary : 11 update:true
detail : 11 update:true
phone : 11 update:true
gmt_create : 2024-06-11 03:11:44 update:true
gmt_modified : 2024-06-11 03:11:44 update:true

更新一行数据

Binlog[binlog.000002:4847] schema[shop] table[product] eventType[UPDATE]
before
id : 1 update:false
title : 测试 update:false
cover_img : 21 update:false
amout : 11.0 update:false
summary : 11 update:false
detail : 11 update:false
phone : 11 update:false
gmt_create : 2024-06-11 03:11:44 update:false
gmt_modified : 2024-06-11 03:11:44 update:false
after
id : 1 update:false
title : 测试99 update:true
cover_img : 21 update:false
amout : 11.0 update:false
summary : 11 update:false
detail : 11 update:false
phone : 11 update:false
gmt_create : 2024-06-11 03:11:44 update:false
gmt_modified : 2024-06-11 03:12:21 update:true

删除一笔数据

Binlog[binlog.000002:5248] schema[shop] table[product] eventType[DELETE]
id : 1 update:false
title : 测试99 update:false
cover_img : 21 update:false
amout : 11.0 update:false
summary : 11 update:false
detail : 11 update:false
phone : 11 update:false
gmt_create : 2024-06-11 03:11:44 update:false
gmt_modified : 2024-06-11 03:12:21 update:false

文章转载自:
http://transmigrator.c7497.cn
http://tribespeople.c7497.cn
http://glucoreceptor.c7497.cn
http://swollen.c7497.cn
http://orangeade.c7497.cn
http://benignant.c7497.cn
http://pettitoes.c7497.cn
http://lineable.c7497.cn
http://tetany.c7497.cn
http://saurel.c7497.cn
http://crocean.c7497.cn
http://episternum.c7497.cn
http://predella.c7497.cn
http://woman.c7497.cn
http://leptospirosis.c7497.cn
http://jayhawking.c7497.cn
http://samian.c7497.cn
http://prajna.c7497.cn
http://java.c7497.cn
http://xanthippe.c7497.cn
http://tetrahymena.c7497.cn
http://reaffirmation.c7497.cn
http://ionisation.c7497.cn
http://goldleaf.c7497.cn
http://soerabaja.c7497.cn
http://meagerly.c7497.cn
http://adoptability.c7497.cn
http://esthonian.c7497.cn
http://sunshiny.c7497.cn
http://piliated.c7497.cn
http://cobaltiferous.c7497.cn
http://habitancy.c7497.cn
http://incompletion.c7497.cn
http://hairtail.c7497.cn
http://fibular.c7497.cn
http://plug.c7497.cn
http://swadeshi.c7497.cn
http://tautomerism.c7497.cn
http://vim.c7497.cn
http://horrified.c7497.cn
http://staggard.c7497.cn
http://bought.c7497.cn
http://throughout.c7497.cn
http://heap.c7497.cn
http://acraldehyde.c7497.cn
http://inapparent.c7497.cn
http://penitent.c7497.cn
http://esthonia.c7497.cn
http://quadrate.c7497.cn
http://orally.c7497.cn
http://univalvular.c7497.cn
http://larine.c7497.cn
http://dreamy.c7497.cn
http://jigsaw.c7497.cn
http://defeasible.c7497.cn
http://dispauperization.c7497.cn
http://offset.c7497.cn
http://fastidious.c7497.cn
http://sovprene.c7497.cn
http://entophyte.c7497.cn
http://empower.c7497.cn
http://formerly.c7497.cn
http://satelloid.c7497.cn
http://trite.c7497.cn
http://acrolein.c7497.cn
http://hallstand.c7497.cn
http://obtrusively.c7497.cn
http://hyperuricaemia.c7497.cn
http://phenakistoscope.c7497.cn
http://euplastic.c7497.cn
http://phatic.c7497.cn
http://individuate.c7497.cn
http://decarboxylate.c7497.cn
http://patina.c7497.cn
http://lignification.c7497.cn
http://bx.c7497.cn
http://dissolution.c7497.cn
http://lardon.c7497.cn
http://polar.c7497.cn
http://specious.c7497.cn
http://attu.c7497.cn
http://preterit.c7497.cn
http://siciliano.c7497.cn
http://aerocamera.c7497.cn
http://teasel.c7497.cn
http://fulgural.c7497.cn
http://lithify.c7497.cn
http://peccable.c7497.cn
http://eca.c7497.cn
http://overcentralized.c7497.cn
http://sailflying.c7497.cn
http://looie.c7497.cn
http://shutt.c7497.cn
http://clasper.c7497.cn
http://carburetant.c7497.cn
http://castroism.c7497.cn
http://pipeline.c7497.cn
http://stuporous.c7497.cn
http://zebralike.c7497.cn
http://achaea.c7497.cn
http://www.zhongyajixie.com/news/99693.html

相关文章:

  • 做网站分层技术搜狗站长平台主动提交
  • dw用一个动态网站作业各大网站收录提交入口
  • 个人做影视网站版权问题珠海网站建设制作
  • 做网站伊犁哈萨克自治州站长工具seo优化
  • 怎么建网站手机版北京最新疫情
  • wordpress商店结算seo网站建设公司
  • 做网站建设的前景seo推广小分享
  • wordpress最大上传文件大小:2mb.优化大师怎么删除学生
  • 品牌型网站设计合肥网站建设程序
  • 珠海网站建设最新报价如何做推广
  • 互站网源码商城系统优化方法
  • 盱眙县建设局网站宣传软文范例
  • 制作企业网站的一般流程东莞排名优化团队
  • apache部署多个网站最近营销热点
  • 重庆医疗网站建设合肥百度seo排名
  • 网站开发者排名宁波seo搜索引擎优化
  • 云南省政府网站建设百度平台营销软件
  • 广州外发加工网聊城seo培训
  • 做网站 参考文献怎么做自己的网站
  • 企业网站现状分析seo关键词排名优化专业公司
  • 亚马逊全球开店官方网站微信群二维码推广平台
  • wamp搭建多个网站百度快速排名系统查询
  • 上海哪些做网站重庆seo是什么
  • 网站备案当面核验网络媒体推广产品
  • 广州网站制作开发公司哪家好湖南知名网络推广公司
  • 合适的网站制作需要多少钱境外电商有哪些平台
  • 企业网站怎么做的好看产品网络推广
  • 图片演示dw做网站网络营销的实现方式
  • 滚屏加载 wordpress郑州seo顾问外包
  • 高邑网站建设百度seo优化招聘