#############################
# ogg v19.1
#############################
测试通过ogg从mysql 8 同步数据至 mysql 5.7
同时使用ogg的远程抽取功能,即ogg抽取进程与源端部署在不同的服务器。
远程抽取 + 远程应用,省去了投递dat文件这一步。
解压ogg安装包
./ggsci
create subdirs
edit params mgr
port 8006
dynamicportlist 8006-8010
autorestart extract *, retries 5, waitminutes 3
purgeoldextracts /opt/ogg19/dirdat/*,usecheckpoints,minkeepfiles 10
LAGREPORTHOURS 5
LAGINFOMINUTES 10
LAGCRITICALMINUTES 15
start mgr
源DB创建用户
create user ogg@'%' identified by 'xxx';
grant all privileges on **.** to ogg@'%';(暂时给所有权限,后续再测试权限最小化)
flush privileges;
OGG测试到源DB连通性
dblogin sourcedb [email protected]:3316, userid ogg, password xxx
配置抽取进程(远程抽取)
edit params ext_wjf
extract ext_wjf
sourcedb [email protected]:3316, userid ogg, password XXXX
TRANLOGOPTIONS ALTLOGDEST REMOTE
exttrail ./dirdat/ew
table db1.*;
add extract ext_wjf, tranlog, begin now
add exttrail ./dirdat/ew, extract ext_wjf
目标端建用户
create user ogg_replicat@'%' identified by 'xxx';
grant select,insert,update,delete on bakdata.t1 to ogg_replicat@'%';(只给同步表的操作权限)
--此处手工创建的checkpoint_table,采用最小化赋权
grant select,insert,update,delete on bakdata.checkpoint_table to ogg_replicat@'%';
grant select,insert,update,delete on bakdata.checkpoint_table_lox to ogg_replicat@'%';
--也可以使用自动创建,需要create权限
grant create on bakdata.* to ogg_replicat@'%';(临时创建checkpoint_table使用)
flush privileges;
配置应用进程
./ggsci
dblogin sourcedb [email protected]:3306, userid ogg_replicat, password xxx
# 自动创建checkpointtable
add checkpointtable bakdata.checkpoint_table
edit param rep_wjf
replicat rep_wjf
dboptions HOST 99.48.210.114,connectionport 3306
targetdb bakdata,userid ogg_replicat,PASSWORD xxxx
assumetargetdefs
DISCARDFILE ./dirrpt/rep_wjf.dsc,append,megabytes 50
MAP db1.t1,target bakdata.t1;
ADD REPLICAT rep_wjf, EXTTRAIL ./dirdat/ew,CHECKPOINTTABLE bakdata.checkpoint_table
测试数据同步—(成功)
insert/update/delete