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

门户网站集群建设域名注册服务商

门户网站集群建设,域名注册服务商,以下哪一项不属于seo对网站推广的作用,建筑模板的种类客户要求实时同步表的数据到mysql,但这个表在tidb。 测试直接通过tidb cdc写入到mysql,有些字段是null,所以中间加了一个kafka实现 客户库中创建表 CREATE TABLE tb_1 (id bigint primary key,cid bigint,gid bigint,fee DECIMAL(10,2),cre…

客户要求实时同步表的数据到mysql,但这个表在tidb。
测试直接通过tidb cdc写入到mysql,有些字段是null,所以中间加了一个kafka实现

客户库中创建表
CREATE TABLE tb_1 (id bigint primary key,cid bigint,gid bigint,fee DECIMAL(10,2),created_at timestamp,type smallint,remark string ,key i_cid(cid)
);
tidb配置cdc,写入到kafka

1、tidb添加cdc组件
2、配置cdc任务
cat your.toml

case-sensitive = true
enable-old-value = true
[filter]
rules = ['db.tb_1']

3、启动任务

tiup ctl:v5.3.0 cdc changefeed create --pd=http://pd-ip:2379 \
--sink-uri="kafka://kafka-ip:9092/your-topic?kafka-version=1.1.1&partition-num=1&max-message-bytes=67108864&replication-factor=1&protocol=canal-json" --changefeed-id="my" --sort-engine="unified" \
--start-ts=453870757254529193 --config your.toml

protocol=canal-json 使用这个格式
–start-ts这个通过一次导出查看,cat db/metadata

dumpling -u root -p pwd -h tidb-ip -P 3306  -F 1GiB --compress gzip -t 2 -o db -B db -T db.tb --where "cid=123456"

4、更新一条数据,看看kafka是不是有了

创建SQL作业,从kafka消费后入mysql
CREATE TABLE tb_1 (id bigint,cid bigint,gid bigint,fee DECIMAL(10,2),create_time timestamp,type smallint,remark string,PRIMARY KEY (`id`) NOT ENFORCED
) WITH (-- 定义 Kafka 参数'connector' = 'kafka','topic' = 'your-topic','scan.startup.mode' = 'latest-offset', 'properties.bootstrap.servers' = 'ip:9092','properties.group.id' = 'your-group','format' = 'canal-json', -- tidb 支持该方式'canal-json.ignore-parse-errors' = 'false'
);CREATE TABLE kh_tb_1 (id bigint,cid bigint,gid bigint,fee DECIMAL(10,2),create_time timestamp,type smallint,remark string,PRIMARY KEY (`id`) NOT ENFORCED
) WITH ('connector' = 'jdbc','url' = 'jdbc:mysql://xxxxxx:3306/db?rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai','table-name' = 'tb_1','username' = 'user','password' = 'pwd','sink.buffer-flush.max-rows' = '5000','sink.buffer-flush.interval' = '2s','sink.max-retries' = '10'
);insert into kh_tb_1 select * from tb_1 where cid=xxxxxxx;

最后启动作业任务即可。

http://www.dtcms.com/a/439256.html

相关文章:

  • MSF后渗透(提权)
  • 优秀的摄影作品网站企业管理课程视频
  • SNP亮相2025德莱维数字技术行业峰会
  • 中文人名生成器中文姓名姓氏名字称呼日本人名翻译人名英文人名可用于中文分词人名实体识别
  • 【Svelte】加载数据实现响应式的正确方式
  • 出售自己的网站Add-ons wordpress
  • 网络安全相关的专业术语
  • 帝国cms影视网站模板宁波网站制作哪家强
  • (一)算法
  • 23ICPC济南站补题
  • 商务网站建设ppt模板培训网站排名
  • 南阳市宛城区建设局网站设计本质
  • nacos使用指南
  • 中山AI搜索哪家好?GEO优化与传统SEO深度解析
  • MySQL优化----非查询SQL优化
  • 影视网站代理徐州市经济技术开发区建设局网站
  • 基于单片机的三相逆变电源设计
  • Python基础入门例程92-NP92 公式计算器
  • MyCat实现分库分表
  • 宿迁网站建设公司宣传海报制作
  • 中铁中基建设集团网站品牌形象网站源码
  • 中医院网站源码传智黑马培训机构
  • python全栈(基础篇)——day01:环境准备(python解释器安装+pycharm专业版的下载+vscode编辑器+汉化设置)
  • CodeForces Round 1054(div.3)C题
  • 南宁网站建设制作定制seo搜索引擎优化招聘
  • 3.java常用类知识点
  • 费马小定理证明
  • 建设中网站源码微信小程序怎么注册申请
  • iis7.5 没有默认网站彩票网站代理
  • 汇编语言Debug工具与常用指令完全指南