-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于全量数据同步时的优化建议 #116
Comments
赞同 可以试下 先取 min(id) max(id) 然后设定batch =1000(3000/5000等) 开启20个worker 并发执行上面的子任务效率更快
|
可以加一下您的联系方式吗 学习一下go-mysql-transfer
------------------ 原始邮件 ------------------
发件人: "wj596/go-mysql-transfer" ***@***.***>;
发送时间: 2022年10月21日(星期五) 上午7:48
***@***.***>;
抄送: "a『♀※♂@***@***.******@***.***>;
主题: Re: [wj596/go-mysql-transfer] 关于全量数据同步时的优化建议 (Issue #116)
赞同 可以试下 先取 min(id) max(id) 然后设定batch =1000(3000/5000等)
where id>0 and id<= 1000
where id>1000 and id<= 2000
where id>2000 and id<=3000
开启20个worker 并发执行上面的子任务效率更快
调研使用go-mysql-transfer时,发现千万级别的大表数据同步时,对于mysql的压力很大, 优化建议: 将 select b.* from (select %s from %s order by %s limit %d,%d) a left join %s b on a.%s=b.%s 通过EXPLAIN 虚拟表并未用到索引 期望优化成 : SELECT * FROM table where id > 0 order by id limit 100 通过迭代主键id 的方式替换掉 使用虚拟表的方式
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
v信:chengcxy86 |
下午先改了一版 https://github.com/chengcxy/go-mysql-transfer |
兄弟 你的版本 是否支持MYSQL 同步到MYSQL呢? 另外是否支持配置方式 同步到过个目标,多个表呢? |
如果是mysql同步到mysql 可以使用其他工具 ,比如 mysql自带的数据同步功能,otter,yugong, canal ,DataX,dbsyncer,
…------------------ 原始邮件 ------------------
发件人: "wj596/go-mysql-transfer" ***@***.***>;
发送时间: 2023年3月29日(星期三) 下午2:24
***@***.***>;
抄送: "a『♀※♂@***@***.******@***.***>;
主题: Re: [wj596/go-mysql-transfer] 关于全量数据同步时的优化建议 (Issue #116)
兄弟 你的版本 是否支持MYSQL 同步到MYSQL呢? 另外是否支持配置方式 同步到过个目标,多个表呢?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
自己写一个脚本 批量生成datax的json配置文件 或者自己造轮子 没什么复杂的 读取到schema,切分读取,拼接insert intosql语句 能自动读取到配置即可 |
canal 是要自己开发客户端啊 |
其他几个工具你也可以调用一下
…------------------ 原始邮件 ------------------
发件人: "wj596/go-mysql-transfer" ***@***.***>;
发送时间: 2023年3月30日(星期四) 下午2:34
***@***.***>;
抄送: "a『♀※♂@***@***.******@***.***>;
主题: Re: [wj596/go-mysql-transfer] 关于全量数据同步时的优化建议 (Issue #116)
如果是mysql同步到mysql 可以使用其他工具 ,比如 mysql自带的数据同步功能,otter,yugong, canal ,DataX,dbsyncer,
…
------------------ 原始邮件 ------------------ 发件人: "wj596/go-mysql-transfer" @.>; 发送时间: 2023年3月29日(星期三) 下午2:24 @.>; 抄送: "a『♀※♂@@.@.>; 主题: Re: [wj596/go-mysql-transfer] 关于全量数据同步时的优化建议 (Issue #116) 兄弟 你的版本 是否支持MYSQL 同步到MYSQL呢? 另外是否支持配置方式 同步到过个目标,多个表呢? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
canal 是要自己开发客户端啊
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
是的,我之前做了一版改动,但是我的场景是异构数据同步最后使用的其他方案
…------------------ 原始邮件 ------------------
发件人: "wj596/go-mysql-transfer" ***@***.***>;
发送时间: 2023年3月29日(星期三) 晚上10:55
***@***.***>;
抄送: "a『♀※♂@***@***.******@***.***>;
主题: Re: [wj596/go-mysql-transfer] 关于全量数据同步时的优化建议 (Issue #116)
自己写一个脚本 批量生成datax的json配置文件 或者自己造轮子 没什么复杂的 读取到schema,切分读取,拼接insert intosql语句 能自动读取到配置即可
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
其他工具 只有dbsyncer 稍微符合下要, 不过它不支持REDIS |
go-mysql-transfer 这工具 配置挺易的 就单表,单目标 不太实用, 要自己写LUA脚本 |
是的, 要看场景,如果简单的或者要求不高的话可以使用这个工具
…------------------ 原始邮件 ------------------
发件人: "wj596/go-mysql-transfer" ***@***.***>;
发送时间: 2023年3月30日(星期四) 下午4:21
***@***.***>;
抄送: "a『♀※♂@***@***.******@***.***>;
主题: Re: [wj596/go-mysql-transfer] 关于全量数据同步时的优化建议 (Issue #116)
go-mysql-transfer 这工具 配置挺易的 就单表,单目标 不太实用, 要自己写LUA脚本
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
int类型的主键可以,uuid的主键这种方式不行 |
是的,我们主键自增id 创建时间 更新时间是建表时候的必带字段,如果业务上有uuid作为唯一键的要求,我们做法是主键自增id,uuid列添加唯一索引 |
调研使用go-mysql-transfer时,发现千万级别的大表数据同步时,对于mysql的压力很大,
优化建议:
将 select b.* from (select %s from %s order by %s limit %d,%d) a left join %s b on a.%s=b.%s
通过EXPLAIN 虚拟表并未用到索引
期望优化成 : SELECT * FROM
table
whereid
> 0 order byid
limit 100通过迭代主键id 的方式替换掉 使用虚拟表的方式
The text was updated successfully, but these errors were encountered: