ogg 当同步某张表的源端有大量并发操作时,如INSERT UPDATE千万级数据记录操作。同步链路的入库
进程不能及时的处理,将产生数据同步延时。此时可以使用OGG的range参数据将单个进程拆分为多个进程,
同时读取trail文件,并行操作,提高入库进程数据同步效率。防止数据延时对生产的影响。具体操作步骤如下:
1. 创建配置文件 vi ggs/dirprm
RQFTJ001.prm
RQFTJ002.prm
RQFTJ003.prm
RQFTJ004.prm
RQFTJ005.prm
RQFTJ006.prm
RQFTJ007.prm
RQFTJ008.prm
参数略...
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (1, 8));
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (2, 8));
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (3, 8));
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (4, 8));
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (5, 8));
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (6, 8));
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (7, 8));
MAP HX_SB.SB_YSBTJ, TARGET HX_SB.SB_YSBTJ, FILTER (@RANGE (8, 8));
2. 停止 replicat进程
stop RQFCQST1
如有延时STOP停不了,可以
kill RQFCQST1
3. 查看replicat进程, 记录检查点
info RQFCQST1
GGSCI (cqstzjdbqf01) 23> info RQFCQST1
REPLICAT RQFCQST1 Last Started 2014-02-26 22:28 Status ABENDED
Checkpoint Lag 15:22:58 (updated 00:04:22 ago)
Log Read Checkpoint File ./dirdat/qf001968
2014-03-03 03:14:16.033308 RBA 220416732
4. 修改原进程
$ ggsci
edit param RQFCQST1
MAPEXCLUDE HX_SB.SB_YSBTJ;
5. 增加进程
$ ggsci
add replicat RQFTJ001, exttrail ./dirdat/qf
add replicat RQFTJ002, exttrail ./dirdat/qf
add replicat RQFTJ003, exttrail ./dirdat/qf
add replicat RQFTJ004, exttrail ./dirdat/qf
add replicat RQFTJ005, exttrail ./dirdat/qf
add replicat RQFTJ006, exttrail ./dirdat/qf
add replicat RQFTJ007, exttrail ./dirdat/qf
add replicat RQFTJ008, exttrail ./dirdat/qf
6. 修改检查点
$ ggsci
alter replicat RQFTJ001, extseqno 1968, extrba 220416732
alter replicat RQFTJ002, extseqno 1968, extrba 220416732
alter replicat RQFTJ003, extseqno 1968, extrba 220416732
alter replicat RQFTJ004, extseqno 1968, extrba 220416732
alter replicat RQFTJ005, extseqno 1968, extrba 220416732
alter replicat RQFTJ006, extseqno 1968, extrba 220416732
alter replicat RQFTJ007, extseqno 1968, extrba 220416732
alter replicat RQFTJ008, extseqno 1968, extrba 220416732
7. 启动进程
$ ggsci
start RQFCQST1
start RQFTJ001
start RQFTJ002
start RQFTJ003
start RQFTJ004
start RQFTJ005
start RQFTJ006
start RQFTJ007
start RQFTJ008
8. 查看进程状态
$ ggsci
info all