안녕하세요.
‘수상한 김토끼’ 입니다.
이 포스팅은 Oracle Database 19c에 OGG(소스)를 설치하고 MySQL 8.0을 타겟으로 복제를 설정하는 과정을 정리 한 내용입니다.
설치과정은 크게 동기화를 수행할 DB생성과 OGG를 설치하고 구성하는 2개의 과정으로 진행됩니다.
우선 Oracle Database 19c에 OGG(소스)를 설정하는 과정은 2장. Oracle GoldenGate 연동설정 (Oracle 19c)과 동일하게 진행 해 주신 후 본 포스팅에서 진행하는 MySQL관련 OGG 타겟 설정 부분을 진행 해 주시면 됩니다.
2024.07.23 - [Oracle Fusion Middleware/GoldenGate] - 2장. Oracle GoldenGate 연동설정 (Oracle 19c)
소스 DB는 준비가 되었으니 MySQL 8.0 버전 설치를 진행해 줍니다.
MySQL repository에 가서 설치 가능한 버전을 확인 후 repository 등록을 진행 합니다.
https://dev.mysql.com/downloads/repo/yum/
저는 Oracle Linux 8 버전에 설치를 진행 중이므로 ‘mysql84-community-release-el8-1.noarch.rpm’를 사용하도록 하겠습니다.
다음 명령으로 repository를 등록 해 줍니다.
yum install https://dev.mysql.com/get/mysql84-community-release-el8-1.noarch.rpm
[root@ogg-mysql-2 ~]# yum install https://dev.mysql.com/get/mysql84-community-release-el8-1.noarch.rpm
Last metadata expiration check: 0:42:09 ago on Thu 18 Jul 2024 03:06:39 AM GMT.
mysql84-community-release-el8-1.noarch.rpm 25 kB/s | 15 kB 00:00
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
mysql84-community-release noarch el8-1 @commandline 15 k
Transaction Summary
=============================================================================================================================================================================
Install 1 Package
Total size: 15 k
Installed size: 17 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mysql84-community-release-el8-1.noarch 1/1
Running scriptlet: mysql84-community-release-el8-1.noarch 1/1
Warning: native mysql package from platform vendor seems to be enabled.
Please consider to disable this before installing packages from repo.mysql.com.
Run: yum module -y disable mysql
Verifying : mysql84-community-release-el8-1.noarch 1/1
Installed:
mysql84-community-release-el8-1.noarch
Complete!
[root@ogg-mysql-2 ~]#
MySQL repository를 등록했으니 MySQL설치를 진행합니다.
yum install mysql-server
[root@ogg-mysql-2 ~]# yum install mysql-server
MySQL 8.4 LTS Community Server 1.1 MB/s | 425 kB 00:00
MySQL Connectors Community 572 kB/s | 135 kB 00:00
MySQL Tools 8.4 LTS Community 668 kB/s | 193 kB 00:00
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
mysql-server x86_64 8.0.36-1.module+el8.9.0+90153+70413b10 ol8_appstream 32 M
Installing dependencies:
mariadb-connector-c-config noarch 3.1.11-2.el8_3 ol8_appstream 15 k
mecab x86_64 0.996-2.module+el8.9.0+90153+70413b10 ol8_appstream 392 k
mysql x86_64 8.0.36-1.module+el8.9.0+90153+70413b10 ol8_appstream 14 M
mysql-common x86_64 8.0.36-1.module+el8.9.0+90153+70413b10 ol8_appstream 136 k
mysql-errmsg x86_64 8.0.36-1.module+el8.9.0+90153+70413b10 ol8_appstream 640 k
protobuf-lite x86_64 3.5.0-15.el8 ol8_appstream 149 k
Enabling module streams:
mysql 8.0
Transaction Summary
=============================================================================================================================================================================
Install 7 Packages
Total download size: 48 M
Installed size: 244 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): mariadb-connector-c-config-3.1.11-2.el8_3.noarch.rpm 163 kB/s | 15 kB 00:00
(2/7): mecab-0.996-2.module+el8.9.0+90153+70413b10.x86_64.rpm 3.8 MB/s | 392 kB 00:00
(3/7): mysql-common-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64.rpm 1.2 MB/s | 136 kB 00:00
(4/7): mysql-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64.rpm 43 MB/s | 14 MB 00:00
(5/7): mysql-errmsg-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64.rpm 2.5 MB/s | 640 kB 00:00
(6/7): protobuf-lite-3.5.0-15.el8.x86_64.rpm 1.1 MB/s | 149 kB 00:00
(7/7): mysql-server-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64.rpm 47 MB/s | 32 MB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 54 MB/s | 48 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/7
Installing : mysql-common-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 2/7
Installing : mysql-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 3/7
Installing : mysql-errmsg-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 4/7
Installing : protobuf-lite-3.5.0-15.el8.x86_64 5/7
Installing : mecab-0.996-2.module+el8.9.0+90153+70413b10.x86_64 6/7
Running scriptlet: mecab-0.996-2.module+el8.9.0+90153+70413b10.x86_64 6/7
Running scriptlet: mysql-server-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 7/7
Installing : mysql-server-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 7/7
Running scriptlet: mysql-server-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 7/7
ValueError: File context for /var/log/mysql(/.*)? already defined
Verifying : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/7
Verifying : mecab-0.996-2.module+el8.9.0+90153+70413b10.x86_64 2/7
Verifying : mysql-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 3/7
Verifying : mysql-common-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 4/7
Verifying : mysql-errmsg-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 5/7
Verifying : mysql-server-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 6/7
Verifying : protobuf-lite-3.5.0-15.el8.x86_64 7/7
Installed:
mariadb-connector-c-config-3.1.11-2.el8_3.noarch mecab-0.996-2.module+el8.9.0+90153+70413b10.x86_64
mysql-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 mysql-common-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64
mysql-errmsg-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64 mysql-server-8.0.36-1.module+el8.9.0+90153+70413b10.x86_64
protobuf-lite-3.5.0-15.el8.x86_64
Complete!
[root@ogg-mysql-2 ~]#
설치가 끝났으니 MySQL을 실행하고 root 패스워드를 변경 해 줍니다.
초기 설치시 root 패스워드가 없으니 아래와 같이 로그인 해서 패스워드를 변경 해 줍니다.
mysql -V
service mysqld start
mysql -u root -p
alter user 'root'@'localhost' identified by 'password';
[root@ogg-mysql-2 ~]# mysql -V
mysql Ver 8.0.36 for Linux on x86_64 (Source distribution)
[root@ogg-mysql-2 ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@ogg-mysql-2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.36 Source distribution
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.01 sec)
mysql>
MySQL 준비가 되었으니 ogg 설치를 진행합니다.
우선 ogg를 설치할 계정을 생성 후 로그인 합니다.
[root@ogg-mysql-2 ~]# useradd ogg
[root@ogg-mysql-2 ~]# passwd ogg
Changing password for user ogg.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@ogg-mysql-2 ~]# exit
logout
[opc@ogg-mysql-2 ~]$ su - ogg
Password:
[ogg@ogg-mysql-2 ~]$
OGG for MySQL 설치 파일(191000_ggs_Linux_x64_MySQL_64bit.zip)을 다운로드 받아야 하는데 한국 오라클 링크는 찾을 수가 없어 일본 오라클 웹페이지에서 다운로드 받았습니다.
https://www.oracle.com/jp/topics/technologies/oracle-goldengate-downloads.html
다운로드 받은 파일을 설치 할 경로에 업로드 하고 압축을 풀어 줍니다.
[ogg@ogg-mysql-2 ogg]$ pwd
/home/ogg/ogg
[ogg@ogg-mysql-2 ogg]$ ls
191000_ggs_Linux_x64_MySQL_64bit.zip
[ogg@ogg-mysql-2 ogg]$ unzip 191000_ggs_Linux_x64_MySQL_64bit.zip
Archive: 191000_ggs_Linux_x64_MySQL_64bit.zip
inflating: ggs_Linux_x64_MySQL_64bit.tar
inflating: OGG-19.1.0.0-README.txt
inflating: OGG_WinUnix_Rel_Notes_19.1.0.0.0.pdf
[ogg@ogg-mysql-2 ogg]$ tar -xvf ggs_Linux_x64_MySQL_64bit.tar
./
./lib/
./lib/libnnz11.so
./lib/libclntsh.so
./libboost_system-mt.so.1.67.0
./ggMessage.dat
./tcperrs
./freeBSD.txt
./libggnnzitp.so
./convprm
./convchk
./mysql_checklist.sql
./pmsrvr
./libicudata.so.62
./sqlldr.tpl
./libPocoUtil.so.60
./version4j.jar
./libdb-6.1.so
./ddl_rewriter_8.so
./chkpt_mysql_create.sql
./libudt.so
./libPocoFoundation.so.60
./libstdc++.so.6
./libicuuc.so.62
./keygen
./libggssl.so
./libicui18n.so.62
./diretc/
./diretc/logging/
./diretc/logging/ogg-audit.xml
./diretc/logging/ogg-ggserr.xml
./diretc/logging/app-pmsrvr-default.xml
./diretc/logging/sca-restapi.xml
./diretc/logging/app-recvsrvr-debug.xml
./diretc/logging/sca-default.xml
./diretc/logging/app-adminsrvr-debug.xml
./diretc/logging/app-extract-events.xml
./diretc/logging/app-adminsrvr-events.xml
./diretc/logging/app-replicat-events.xml
./diretc/logging/app-distsrvr-debug.xml
./diretc/logging/app-ServiceManager-debug.xml
./diretc/logging/app-pmsrvr-debug.xml
./diretc/logging.d/
./libgglog.so
./mysql.txt
./ggparam.dat
./logdump
./libggperf.so
./server
./ggsci
./ddl_metadata.so
./ddl_rewriter.so
./crypto/
./crypto/libccme_ecc.so
./crypto/libcryptocme.sig
./crypto/libccme_asym.so
./crypto/libccme_ecc_accel_fips.so
./crypto/libccme_base.so
./crypto/libcryptocme.so
./crypto/libccme_ecc_non_fips.so
./crypto/libccme_ecc_accel_non_fips.so
./crypto/libccme_base_non_fips.so
./dirout/
./dirout/README.txt
./notices.txt
./libggparam.so
./libggutil.so
./help.txt
./libmysqlclient.so.21
./libPocoNetSSL.so.60
./demo_mysql_insert.sql
./db2cntl.tpl
./emsclnt
./cachefiledump
./demo_mysql_misc.sql
./libPocoXML.so.60
./libPocoCrypto.so.60
./libPocoJSON.so.60
./db_upgrade
./libxerces-c-3.2.so
./libPocoNet.so.60
./libgcc_s.so.1
./ddl_install.sh
./liblmdb.so
./UserExitExamples/
./UserExitExamples/ExitDemo_more_recs/
./UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.AIX
./UserExitExamples/ExitDemo_more_recs/exitdemo_more_recs.vcproj
./UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.LINUX
./UserExitExamples/ExitDemo_more_recs/readme.txt
./UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.HPUX
./UserExitExamples/ExitDemo_more_recs/exitdemo_more_recs.c
./UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.SOLARIS
./UserExitExamples/ExitDemo/
./UserExitExamples/ExitDemo/exitdemo.c
./UserExitExamples/ExitDemo/exitdemo.vcproj
./UserExitExamples/ExitDemo/readme.txt
./UserExitExamples/ExitDemo/exitdemo_utf16.c
./UserExitExamples/ExitDemo/Makefile_exit_demo.HP_OSS
./UserExitExamples/ExitDemo/Makefile_exit_demo.SOLARIS
./UserExitExamples/ExitDemo/Makefile_exit_demo.AIX
./UserExitExamples/ExitDemo/Makefile_exit_demo.HPUX
./UserExitExamples/ExitDemo/Makefile_exit_demo.LINUX
./UserExitExamples/ExitDemo_passthru/
./UserExitExamples/ExitDemo_passthru/Makefile_passthru.SOLARIS
./UserExitExamples/ExitDemo_passthru/Makefile_passthru.LINUX
./UserExitExamples/ExitDemo_passthru/readme.txt
./UserExitExamples/ExitDemo_passthru/Makefile_passthru.HP_OSS
./UserExitExamples/ExitDemo_passthru/exitdemopassthru.vcproj
./UserExitExamples/ExitDemo_passthru/Makefile_passthru.HPUX
./UserExitExamples/ExitDemo_passthru/Makefile_passthru.AIX
./UserExitExamples/ExitDemo_passthru/exitdemo_passthru.c
./UserExitExamples/ExitDemo_lobs/
./UserExitExamples/ExitDemo_lobs/readme.txt
./UserExitExamples/ExitDemo_lobs/exitdemo_lob.c
./UserExitExamples/ExitDemo_lobs/Makefile_lob.LINUX
./UserExitExamples/ExitDemo_lobs/Makefile_lob.SOLARIS
./UserExitExamples/ExitDemo_lobs/exitdemo_lob.vcproj
./UserExitExamples/ExitDemo_lobs/Makefile_lob.HPUX
./UserExitExamples/ExitDemo_lobs/Makefile_lob.AIX
./UserExitExamples/ExitDemo_pk_befores/
./UserExitExamples/ExitDemo_pk_befores/Makefile_pk_befores.HPUX
./UserExitExamples/ExitDemo_pk_befores/readme.txt
./UserExitExamples/ExitDemo_pk_befores/exitdemo_pk_befores.vcproj
./UserExitExamples/ExitDemo_pk_befores/Makefile_pk_befores.LINUX
./UserExitExamples/ExitDemo_pk_befores/Makefile_pk_befores.SOLARIS
./UserExitExamples/ExitDemo_pk_befores/exitdemo_pk_befores.c
./UserExitExamples/ExitDemo_pk_befores/Makefile_pk_befores.AIX
./ddl_metadata_8.so
./libggrepo.so
./mgr
./defgen
./oggerr
./bcrypt.txt
./zlib.txt
./retrace
./ggcmd
./libantlr3c.so
./bcpfmt.tpl
./demo_mysql_load.sql
./metadata_server
./replicat
./prvtclkm.plb
./extract
./SQLDataTypes.h
./ucharset.h
./checkprm
./usrdecs.h
./demo_mysql_create.sql
[ogg@ogg-mysql-2 ogg]$ ls
191000_ggs_Linux_x64_MySQL_64bit.zip ddl_rewriter_8.so ggparam.dat libggrepo.so libPocoXML.so.60 prvtclkm.plb
bcpfmt.tpl ddl_rewriter.so ggsci libggssl.so libstdc++.so.6 replicat
bcrypt.txt defgen ggs_Linux_x64_MySQL_64bit.tar libggutil.so libudt.so retrace
cachefiledump demo_mysql_create.sql help.txt libicudata.so.62 libxerces-c-3.2.so server
checkprm demo_mysql_insert.sql keygen libicui18n.so.62 logdump SQLDataTypes.h
chkpt_mysql_create.sql demo_mysql_load.sql lib libicuuc.so.62 metadata_server sqlldr.tpl
convchk demo_mysql_misc.sql libantlr3c.so liblmdb.so mgr tcperrs
convprm diretc libboost_system-mt.so.1.67.0 libmysqlclient.so.21 mysql_checklist.sql ucharset.h
crypto dirout libdb-6.1.so libPocoCrypto.so.60 mysql.txt UserExitExamples
db2cntl.tpl emsclnt libgcc_s.so.1 libPocoFoundation.so.60 notices.txt usrdecs.h
db_upgrade extract libgglog.so libPocoJSON.so.60 OGG-19.1.0.0-README.txt version4j.jar
ddl_install.sh freeBSD.txt libggnnzitp.so libPocoNet.so.60 oggerr zlib.txt
ddl_metadata_8.so ggcmd libggparam.so libPocoNetSSL.so.60 OGG_WinUnix_Rel_Notes_19.1.0.0.0.pdf
ddl_metadata.so ggMessage.dat libggperf.so libPocoUtil.so.60 pmsrvr
[ogg@ogg-mysql-2 ogg]$
ggsci 명령 alias를 .bash_profile에 설정 후 진행하겠습니다.
[ogg@ogg-mysql-2 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
alias gs='/home/ogg/ogg/ggsci'
[ogg@ogg-mysql-2 ~]$
ggsci에 접속하여 다음 작업을 진행해야 하는데 설치해야 하는 라이브러리가 있습니다.
Oracle Linux 8 기준 아래 2개의 패키지 설치가 필요합니다.
yum install -y libnsl
yum install compat-openssl10
[ogg@ogg-mysql-2 ~]$ gs
/home/ogg/ogg/ggsci: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory
[ogg@ogg-mysql-2 ~]$ exit
logout
[opc@ogg-mysql-2 ~]$ sudo yum install -y libnsl
Last metadata expiration check: 1:12:44 ago on Thu 18 Jul 2024 03:52:40 AM GMT.
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
libnsl x86_64 2.28-251.0.2.el8_10.2 ol8_baseos_latest 112 k
Transaction Summary
=============================================================================================================================================================================
Install 1 Package
Total download size: 112 k
Installed size: 97 k
Downloading Packages:
libnsl-2.28-251.0.2.el8_10.2.x86_64.rpm 1.1 MB/s | 112 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 112 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : libnsl-2.28-251.0.2.el8_10.2.x86_64 1/1
Running scriptlet: libnsl-2.28-251.0.2.el8_10.2.x86_64 1/1
Verifying : libnsl-2.28-251.0.2.el8_10.2.x86_64 1/1
Installed:
libnsl-2.28-251.0.2.el8_10.2.x86_64
Complete!
[opc@ogg-mysql-2 ~]$ su - ogg
Password:
Last login: Thu Jul 18 04:01:01 GMT 2024 on pts/0
[ogg@ogg-mysql-2 ~]$ gs
/home/ogg/ogg/ggsci: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
[ogg@ogg-mysql-2 ~]$ exit
logout
[opc@ogg-mysql-2 ~]$ sudo yum install compat-openssl10
Last metadata expiration check: 1:13:06 ago on Thu 18 Jul 2024 03:52:40 AM GMT.
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
compat-openssl10 x86_64 1:1.0.2o-4.el8_6 ol8_appstream 1.1 M
Transaction Summary
=============================================================================================================================================================================
Install 1 Package
Total download size: 1.1 M
Installed size: 2.9 M
Is this ok [y/N]: y
Downloading Packages:
compat-openssl10-1.0.2o-4.el8_6.x86_64.rpm 11 MB/s | 1.1 MB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 10 MB/s | 1.1 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : compat-openssl10-1:1.0.2o-4.el8_6.x86_64 1/1
Running scriptlet: compat-openssl10-1:1.0.2o-4.el8_6.x86_64 1/1
Verifying : compat-openssl10-1:1.0.2o-4.el8_6.x86_64 1/1
Installed:
compat-openssl10-1:1.0.2o-4.el8_6.x86_64
Complete!
[opc@ogg-mysql-2 ~]$ su - ogg
Password:
Last login: Thu Jul 18 05:05:33 GMT 2024 on pts/0
[ogg@ogg-mysql-2 ~]$ gs
Oracle GoldenGate Command Interpreter for MySQL
Version 19.1.0.0.0 OGGCORE_19.1.0.0.0_PLATFORMS_190508.1447
Linux, x64, 64bit (optimized), MySQL Enterprise on May 8 2019 20:42:57
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
GGSCI (ogg-mysql-2) 1>
subdirs 명령으로 디렉토리를 생성해 줍니다.
GGSCI (ogg-mysql-2) 1> create subdirs
Creating subdirectories under current directory /home/ogg/ogg
Parameter file /home/ogg/ogg/dirprm: created.
Report file /home/ogg/ogg/dirrpt: created.
Checkpoint file /home/ogg/ogg/dirchk: created.
Process status files /home/ogg/ogg/dirpcs: created.
SQL script files /home/ogg/ogg/dirsql: created.
Database definitions files /home/ogg/ogg/dirdef: created.
Extract data files /home/ogg/ogg/dirdat: created.
Temporary files /home/ogg/ogg/dirtmp: created.
Credential store files /home/ogg/ogg/dircrd: created.
Masterkey wallet files /home/ogg/ogg/dirwlt: created.
Dump files /home/ogg/ogg/dirdmp: created.
GGSCI (ogg-mysql-2) 2>
ogg mgr을 설정합니다.
GGSCI (ogg-mysql-2) 2> edit param mgr
port 7810
PURGEOLDEXTRACTS ./dirdat/* , USECHECKPOINTS, MINKEEPHOURS 48
DOWNREPORTMINUTES 30
LAGREPORTMINUTES 5
LAGINFOMINUTES 10
LAGCRITICALMINUTES 60
SYSLOG NONE
GGSCI (ogg-mysql-2) 3>
replicat생성 전 타겟이 될 MySQL 설정을 진행 해 줍니다.
ogg 타겟 용도로 test라는 유저, 데이터베이스를 만들고 테이블을 생성해 주겠습니다.
[ogg@ogg-mysql-2 ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.36 Source distribution
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';
Query OK, 0 rows affected (0.01 sec)
mysql> GRANT ALL ON *.* TO 'test'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE USER 'test'@'10.0.0.208' IDENTIFIED BY 'test';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON *.* TO 'test'@'10.0.0.208';
Query OK, 0 rows affected (0.01 sec)
mysql> CREATE DATABASE test;
Query OK, 1 row affected (0.01 sec)
mysql> use test
Database changed
mysql> CREATE TABLE test
-> (ID INT(10),
-> LASTNAME CHAR(20),
-> FIRSTNAME CHAR(20),
-> PRIMARY KEY (ID)
-> )
-> ENGINE = INNODB;
Query OK, 0 rows affected, 1 warning (0.02 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
ggsci 명령으로 ogg에 접속하여 MySQL에 생성한 test 데이터베이스에 접속을 진행합니다.
[ogg@ogg-mysql-2 ~]$ gs
Oracle GoldenGate Command Interpreter for MySQL
Version 19.1.0.0.0 OGGCORE_19.1.0.0.0_PLATFORMS_190508.1447
Linux, x64, 64bit (optimized), MySQL Enterprise on May 8 2019 20:42:57
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
GGSCI (ogg-mysql-2) 1> dblogin sourcedb test, userid test@10.0.0.203:3306, password "test"
Successfully logged into database.
GGSCI (ogg-mysql-2 DBLOGIN as test) 2>
아래 명령으로 ogg replicat 설정을 진행합니다.
EDIT PARAM REP01
replicat rep01
setenv (MYSQL_UNIX_PORT=/var/lib/mysql/mysql.sock)
DBOPTIONS CONNECTIONPORT 3306
DBOPTIONS HOST 10.0.0.203
targetdb test, userid test, password "test"
HANDLECOLLISIONS
ASSUMETARGETDEFS
SQLEXEC "SET NAMES euckr"
discardfile ./dirrpt/rep01.dsc, purge
map test.test, target test.test;
add replicat rep01, exttrail ./dirdat/ea nodbcheckpoint
GGSCI (ogg-mysql-2 DBLOGIN as test) 2> EDIT PARAM REP01
replicat rep01
setenv (MYSQL_UNIX_PORT=/var/lib/mysql/mysql.sock)
DBOPTIONS CONNECTIONPORT 3306
DBOPTIONS HOST 10.0.0.203
targetdb test, userid test, password "test"
HANDLECOLLISIONS
ASSUMETARGETDEFS
SQLEXEC "SET NAMES euckr"
discardfile ./dirrpt/rep01.dsc, purge
map test.test, target test.test;
GGSCI (ogg-mysql-2 DBLOGIN as test) 3> add replicat rep01, exttrail ./dirdat/ea nodbcheckpoint
REPLICAT added.
GGSCI (ogg-mysql-2 DBLOGIN as test) 4>
생성한 mgr과 rep의 상태를 확인하고 기동시켜 주면 연동 작업은 마무리 됩니다.
GGSCI (ogg-mysql-2 DBLOGIN as test) 4> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER STOPPED
REPLICAT STOPPED REP01 00:00:00 00:00:30
GGSCI (ogg-mysql-2 DBLOGIN as test) 5> start mgr
Manager started.
GGSCI (ogg-mysql-2 DBLOGIN as test) 6> start rep01
Sending START request to MANAGER ...
REPLICAT REP01 starting
GGSCI (ogg-mysql-2 DBLOGIN as test) 7> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP01 00:00:00 00:00:01
GGSCI (ogg-mysql-2 DBLOGIN as test) 8>
여기까지 Oracle Database와 MySQL간의 OGG 구성이 완료 되었습니다.
'Oracle Fusion Middleware > GoldenGate' 카테고리의 다른 글
2장. Oracle GoldenGate 연동설정 (Oracle 19c) (1) | 2024.07.23 |
---|---|
1장. Oracle GoldenGate 설치 (Oracle 19c) (2) | 2024.07.23 |