Goldengate alter extract process after MySQL master Switchover to slave
Oracle数据库有dataguard主从,MySQL有主从或MGR,Goldengate同步支持从前两种数据库做数据抽取,但是在主从切换以后需要在Goldengate做相应的修改。这里记录一下MySQL因master 需要停机维护时,OGG主动切换到slave的方法。
回顾Oracle Dataguard切换ogg操作
1,停应用
2, 等待抽取进程结束
send, show trans
3, 等待pump 读取了所有trails
info, showch
4, 所有抽取和pump完成,查看应用进程
send , status
显示 at EOF
5, 然后主从切换,重置抽取
alter extract xx, begin now alter extract xx, etrollover start extract xx
6,启动pump
alter extract pxx , exseqno xxxx, extrba 0 alter extract pxx, etrollover start extract pxx
7, 启动应用
alter replicat rxx, extseqno xx, extrba 0 start replicat rxx
MySQL主从切换 OGG修改
Positioning Extract to a Specific Start Point
You can position the Extract to a specific start point in the transaction logs using the ADD/ALTER EXTRACT commands:
{ADD | ALTER EXTRACT} group, LOGNUM log_num, LOGPOS log_pos
如果停库也可以像oracle一样 begin now ,或者数据库启用了GTID,可以使用基于Using GTID-based Extract的过滤使用atcsn和aftercsn,当然也可以使用log number和offset的方式。
Oracle GoldenGate Features to Support MySQL Group Replication
The following are Oracle GoldenGate features required to support capture from a MySQL database Group Replication instance.CSN Format
The Extract for MySQL Group Replication uses a new CSN format that is based on the Group Replication Global Transaction ID. This CSN format should be used with ATCSN and AFTERCSN when manually positioning a MySQL Group Replication Extract or Replicat whose source trail was generated by a MySQL Group Replication Extract.
使用mysqlbinlog可以解析出at position offset位置偏移量,备机的show slave status \G,显示的log_Pos也是这个意思 。
看到同事最近有做MYSQL切换MASTER SLAVE, ogg 基于postion的操作,简单记录一下:
1, 停止OGG
2,copy 抽取ogg目录从master到slave主机,并修改配置文件中Ip
scp -r xxx targetHost:/xxxx ggsic> edit params exxx
3, 获取抽取pos
info xx
4, 从binlog中的pos转换出GTID,并得到最后一个GTID事务num
e.g. XXXUUID:101
5, 解析从库的binlog中#4 GTID事务num对应的pos
sed -n '/XXXUUID:101/,/end_log_pos/p' xxx e.g. 12312123
6, 修改抽取的pos
alter extract xxx, lognum xxx, logpos 12312123 -- #5 get pos
7,启动ogg进程.
— over —
对不起,这篇文章暂时关闭评论。