阿里愚公支持mysql到mysql吗_GitHub - xinweishao/yugong-full-increment: 愚公扩展版本,支持全量和增量同步mysql到sqlserver...

yugong

[TOC]

目的

SQL Server -> MySQL 的一致性检查(CHECK)

MySQL -> SQL Server 的回滚(SYNC)

获得 yugong jar 包

方法一:编译 yugong jar 包:

git git@gitlab.yeshj.com:hjarch-practice/yugong.git

cd yugong

mvn clean package

cp target/yugong-shaded.jar .

方法二:

不想编译的同学,

直接点击 Tags · HJArch-Internal / yugong · GitLab ,

找到里面最新的版本,里面有 jar 包下载。

配置文件

有两个配置文件:

properties,配置数据库信息和作业信息

YAML 配置文件,做 Translator 定制化

运行

HJ 使用的 yugong 已经改为 fat jar 模式运行,摒弃了官方的打包流程。

将生成的 fat jar yugong-shaded.jar 拷贝到服务器,即可运行。

运行参数:

-c:使用的 yugong properties,配置数据库信息和作业信息

-y:使用的 YAML 配置文件,做 Translator 定制化

运行命令:

java -jar yugong-shaded.jar -c sync-mssql-mysql.properties -y mssql-mysql.yaml

PS:如果想优化运行速度,可以加入 JAVA_OPTIONS:

JAVA_OPTIONS=("-Xms2048m" "-Xmx3072m" "-Xmn1024m" "-XX:SurvivorRatio=2" "-XX:PermSize=96m" "-XX:MaxPermSize=256m" "-Xss256k" "-XX:-UseAdaptiveSizePolicy" "-XX:MaxTenuringThreshold=15" "-XX:+DisableExplicitGC" "-XX:+UseConcMarkSweepGC" "-XX:+CMSParallelRemarkEnabled" "-XX:+UseCMSCompactAtFullCollection" "-XX:+UseFastAccessorMethods" "-XX:+UseCMSInitiatingOccupancyOnly" "-XX:+HeapDumpOnOutOfMemoryError")

java -server $JAVA_OPTIONS -jar yugong-shaded.jar -c sync-mssql-mysql.properties -y mssql-mysql.yaml

运行之后的错误检查

所有错误日志在 logs 目录下面,范例如下:

logs

├── HJ_OpenPlatform.UserGroups # 每张表的日志

│   ├── applier.log # Applier 日志

│   ├── check.log # 一致性检查日志

│   ├── extractor.log # Extractor 日志

│   └── table.log # 表操作日志

└── yugong

└── table.log # yugong 的系统日志

运行之后,需要重点观察 check.log 和 table.log 确保里面没有 ERROR 信息。

可以通过 grep -r ERROR logs 检查错误。

每次操作会记录进度,用来断点续接。想重新开始跑应用,

需要删除当前目录下的 logs / positioner_data。

Quick Start

获取 yugong-shaded.jar 之后,做一下操作可以快速使用 yugong:

修改 properties 里面的数据库配置:

yugong.database.source.url=

yugong.database.source.username=

yugong.database.source.password=

yugong.database.target.url=

yugong.database.target.username=

yugong.database.target.password=

修改 properties 里面的表配置,添加需要迁移的表(yugong 是白名单模式):

yugong.table.white=

修改 properties 里面的运行模式,CHECK(检查模式),FULL(写入模式):

yugong.table.mode=

运行

Tips

odjbc missing:

ould not resolve dependencies for project com.taobao.yugong:yugong:jar:1.2.0:

The following artifacts could not be resolved: com.oracle:ojdbc14:jar:10.2.0.4.0,

com.alibaba.otter:canal.client:jar:1.0.25-SNAPSHOT:

Failure to find com.oracle:ojdbc14:jar:10.2.0.4.0 in

http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository,

resolution will not be reattempted until the update interval of maven.aliyun.com

has elapsed or updates are forced

open http://www.oracle.com/technetwork/apps-tech/jdbc-10201-088211.html

# download ojbc14_g.jar

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -Dfile=ojdbc14_g.jar -DgeneratePom=true

canal-client missing:

Could not resolve dependencies for project com.taobao.yugong:yugong:jar:1.2.0: Failure to find

com.alibaba.otter:canal.client:jar:1.0.25-SNAPSHOT in

https://oss.sonatype.org/content/repositories/snapshots was cached in the local repository,

resolution will not be reattempted until the update interval of sonatype has elapsed or updates are

forced

git clone https://github.com/alibaba/canal

cd canal

git checkout 2cebfa0

mvn clean install

需要帮助怎么办?

请联系作者 3D,CCTalk 找我「狄敬超」。

相关文章:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值