从TiDB迁移数据到另外一个TiDB

背景:从一个TiDB需要迁移数据到另外一个TiDB。

mysql -uroot -p'123456_fan' -h '10.21.108.174' -P4036
mysql -uroot -p'4rfv1az' -h '10.21.108.174' -P 4136 


1 全量数据迁移:

 导出全量数据

/root/tidb-toolkit-v5.4.3-linux-amd64/bin/dumpling  -u root  -P 4036 -p '123456_fan'  -h 10.21.108.174 --filetype sql  -t 4 -o /data/backup_data/  -r 200000  -F 256MiB -B sysbench_test


/root/tidb-toolkit-v5.4.3-linux-amd64/bin/tidb-lightning -config tidb-lightning.toml

cdc cli changefeed create --pd=http://10.21.108.174:2379 --sink-uri="mysql://root:4rfv&UJM@10.21.108.174:4136/" --changefeed-id="449265069501972483" --sort-engine="unified"


/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed create --pd=http://10.21.108.174:2379 --sink-uri="mysql://root:4rfv&UJM@10.21.108.174:4136/" --changefeed-id="449248458749247490" --sort-engine="unified"


/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed create --pd=http://10.21.108.174:2379 --sink-uri="mysql://root:4rfv&UJM@10.21.108.174:4136/" --changefeed-id="simple-replication-task" --sort-engine="unified" --start-ts=“477517256” --config=changefeed_tidb.toml


/root/.tiup/components/cdc/v5.3.3/cdc   cli changefeed list --pd=http://10.21.108.174:2379


/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed query -s --pd=http://10.21.108.174:2379 --changefeed-id=replication-1

/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed query  --pd=http://10.21.108.174:2379 --changefeed-id=replication-1

/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed pause --pd=http://10.21.108.174:2379 --changefeed-id simple-replication-task

/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed remove --pd=http://10.21.108.174:2379 --changefeed-id replication-1


完美:
/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed create --pd=http://10.21.108.174:2379 --sink-uri="mysql://root:4rfv&UJM@10.21.108.174:4136/" --changefeed-id="replication-1" --sort-engine="unified" --start-ts=449265069501972483 --config=changefeed_tidb.toml

校验:
/root/.tiup/components/cdc/v5.3.3/cdc cli changefeed create --pd=http://10.21.108.174:2379 --sink-uri="mysql://root:4rfv&UJM@10.21.108.174:4136/" --changefeed-id="replication-1" --sort-engine="unified" --start-ts=449265069501972483 --config=changefeed_tidb.toml --sync-point=true  --sync-interval=5m 


SELECT * FROM tidb_cdc.syncpoint_v1 WHERE cf = 'replication-1' ORDER BY primary_ts DESC LIMIT 1;

--sync-point=true  --sync-interval=5m create

--
然后按照 sync-diff-inspector 的 Datasource 配置,在上下游的 snapshot 配置项中填写相应值。


 ./sync_diff_inspector --config=./config_1.toml


######################### Datasource config ########################
[data-sources.uptidb]
host = "10.21.108.174"
port = 4036
user = "root"
password = ""
snapshot = "449249965710508032"


[data-sources.downtidb]
host = "10.21.108.174"
port = 4136
user = "root"
password = ""
snapshot = "449263587201122305"


 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值