您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“怎么搭建OGG 12c MySQL to MySQL”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
安裝包下載
下載最新的OGG FOR MySQL,這里使用的是
ggs_121210_Linux_x64_MySQL_64bit.zip
官方下載地址:
http://www.oracle.com/technetwork/cn/middleware/goldengate/downloads/index.html
source和target端的OGG安裝
創(chuàng)建OGG主目錄
mkdir /ogg
解壓安裝包,會得到一個tar文件
unzip ggs_121210_Linux_x64_MySQL_64bit.zip
將tar文件移至OHGG主目錄,并解壓即可
mv ggs_Linux_x64_MySQL_64bit.tar /ogg/
tar xvf ggs_Linux_x64_MySQL_64bit.tar
修改環(huán)境變量
vi ~/.bash_profile
加入如下三個變量
export GGHOME=/ogg
export PATH=$PATH:$GGHOME
export LD_LIBRARY_PATH=/ogg:$LD_LIBRARY_PATH
登入OGG創(chuàng)建OGG的相關(guān)目錄
[root@20_138-Mysql_Test1 ogg]# ./ggsci
Oracle GoldenGate Command Interpreter FOR MySQL
VERSION 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140920.0203
Linux, x64, 64BIT (optimized), MySQL Enterprise ON Sep 20 2014 03:43:22
Operating system CHARACTER SET IDENTIFIED AS UTF-8.
Copyright (C) 1995, 2014, Oracle AND/OR its affiliates. ALL rights reserved.
GGSCI (20_138-Mysql_Test1) 1> CREATE subdirs
Creating subdirectories under current DIRECTORY /ogg
Parameter files /ogg/dirprm: already EXISTS
Report files /ogg/dirrpt: created
Checkpoint files /ogg/dirchk: created
PROCESS STATUS files /ogg/dirpcs: created
SQL script files /ogg/dirsql: created
DATABASE definitions files /ogg/dirdef: created
EXTRACT DATA files /ogg/dirdat: created
TEMPORARY files /ogg/dirtmp: created
Credential store files /ogg/dircrd: created
Masterkey wallet files /ogg/dirwlt: created
Dump files /ogg/dirdmp: created
配置MGR
GGSCI (20_138-Mysql_Test1) 2> dit params mgr
PORT 7809
配置SOURCE端
GGSCI (20_138-Mysql_Test1) 4> dblogin sourcedb oggtest@localhost:3306,userid root,PASSWORD test123
Successfully logged INTO database.
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 4> ADD EXTRACT e1,tranlog,BEGIN NOW
EXTRACT added.
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 6> ADD exttrail /ogg/dirdat/e1,EXTRACT e1
EXTTRAIL added.
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 7> edit params e1
EXTRACT e1
setenv (MYSQL_HOME="/var/lib/mysql")
tranlogoptions altlogdest /var/lib/mysql/mysql-bin.index
sourcedb oggtest@localhost:3306,userid root,PASSWORD test123
exttrail /ogg/dirdat/e1
dynamicresolution
gettruncates
TABLE oggtest.*;
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 20> ADD EXTRACT p1,exttrailsource /ogg/dirdat/e1
EXTRACT added.
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 21> ADD rmttrail /ogg/dirdat/r1,EXTRACT p1
RMTTRAIL added.
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 22> edit param p1
EXTRACT p1
rmthost 192.168.20.139,mgrport 7809
rmttrail /ogg/dirdat/r1
passthru
gettruncates
TABLE oggtest.*;
配置TARGET端
GGSCI (20_139-Mysql_Test2) 3> dblogin sourcedb oggtest@localhost:3306,userid root,PASSWORD work123
Successfully logged INTO database.
GGSCI (20_139-Mysql_Test2 DBLOGIN AS root) 4> ADD checkpointtable oggtest.checkpoint
Successfully created checkpoint TABLE oggtest.checkpoint.
GGSCI (20_139-Mysql_Test2 DBLOGIN AS root) 5> ADD replicat r1,exttrail /ogg/dirdat/r1,checkpointtable oggtest.checkpoint
REPLICAT added.
GGSCI (20_139-Mysql_Test2 DBLOGIN AS root) 5> edit params r1
replicat r1
dboptions HOST localhost,connectionport 3306
targetdb oggtest,userid root,PASSWORD test123
assumetargetdefs
DISCARDFILE /ogg/dirrpt/r1.dsc,append,megabytes 50
MAP oggtest.*,target oggtest.*;
初始化數(shù)據(jù)
主庫master-data方式導(dǎo)出oggtest庫,該方式會記錄導(dǎo)出時的log_file 信息
mysqldump -uroot -p --master-DATA oggtest > oggtest.sql
打開oggtest.sql 找到下面內(nèi)容,記錄下log_file和log_pos
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=5054;
修改extract e1 從導(dǎo)出的時的binlog開始抽取
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 54> ALTER EXTRACT e1,VAM,lognum 3,logpos 5054
EXTRACT altered.
開啟同步
開啟抽取進(jìn)程
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 59> START e1
Sending START request TO MANAGER ...
EXTRACT E1 STARTING
開啟投遞進(jìn)程
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 59> START P1
Sending START request TO MANAGER ...
EXTRACT P1 STARTING
target端開啟應(yīng)用進(jìn)程
GGSCI (20_139-Mysql_Test2 DBLOGIN AS root) 5> START r1
Sending START request TO MANAGER ...
EXTRACT R1 STARTING
觀察進(jìn)程狀態(tài)
SOURCE端
GGSCI (20_138-Mysql_Test1 DBLOGIN AS root) 63> info ALL
Program STATUS GROUP Lag AT Chkpt TIME Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING E1 00:00:00 00:00:03
EXTRACT RUNNING P1 00:00:00 00:00:07
TARGET端
GGSCI (20_139-Mysql_Test2 DBLOGIN AS root) 40> info ALL
Program STATUS GROUP Lag AT Chkpt TIME Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING R1 00:00:00 00:00:09
主庫插入數(shù)據(jù),觀察ogg日志信息,備庫查看是否同步,查錯拍錯
“怎么搭建OGG 12c MySQL to MySQL”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。