Configure Destination
As before, we have to configure:
- Install and Configure Mongo
- Properties File
- OGG Replicat
Install & Configure Mongo
Install & Configure Mongo
[oracle@edvmr1p0 stage]$ mkdir mongodb [oracle@edvmr1p0 stage]$ cp bson-3.2.2.jar mongodb-driver-3.2.2.jar mongodb-driver-core-3.2.2.jar mongodb [oracle@edvmr1p0 stage]$ ls -l mongodb total 1468 -rw-r--r-- 1 oracle oinstall 228188 Nov 12 17:04 bson-3.2.2.jar -rw-r--r-- 1 oracle oinstall 345521 Nov 12 17:04 mongodb-driver-3.2.2.jar -rw-r--r-- 1 oracle oinstall 912570 Nov 12 17:04 mongodb-driver-core-3.2.2.jar
After that we can start the Mongo:
Start Mongo
[oracle@edvmr1p0 oggtrg]$ mongod 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] MongoDB starting : pid=19809 port=27017 dbpath=/data/db 64-bit host=edvmr1p0 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] db version v3.4.1 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] git version: 5e103c4f5583e2566a45d740225dc250baacfbd7 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] allocator: tcmalloc 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] modules: none 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] build environment: 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] distmod: rhel62 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] distarch: x86_64 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] target_arch: x86_64 2020-11-12T17:09:08.991+0000 I CONTROL [initandlisten] options: {} 2020-11-12T17:09:09.009+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'. 2020-11-12T17:09:09.009+0000 I STORAGE [initandlisten] 2020-11-12T17:09:09.009+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recomm
Configure Properties file
Configure Mongo Properties file(e.g. OGG_TRGHOME/dirprm/mongo.properties
[oracle@edvmr1p0 stage]$ trg [oracle@edvmr1p0 oggtrg]$ cd dirprm [oracle@edvmr1p0 dirprm]$ vi mongo.properties gg.handlerlist=mongodb gg.handler.mongodb.type=mongodb gg.handler.mongodb.clientURI=mongodb://localhost:27017/ goldengate.userexit.timestamp=utc goldengate.userexit.writers=javawriter javawriter.stats.display=TRUE javawriter.stats.full=TRUE gg.log=log4j gg.log.level=INFO gg.report.time=30sec gg.classpath=/stage/mongodb/* jvm.bootoptions=-Xmx512m -Xms32m - Djava.class.path=.:ggjava/ggjava.jar:./dirprm
Configure the OGG replicat
Finally, we can configure the the Golden Gate Replicat
Configure Golden Gate replicat
[oracle@edvmr1p0 dirprm]$ trg [oracle@edvmr1p0 oggtrg]$ ggsci Oracle GoldenGate Command Interpreter Version 12.2.0.1.160823 OGGCORE_OGGADP.12.2.0.1.0_PLATFORMS_161019.1437 Linux, x64, 64bit (optimized), Generic on Oct 19 2016 16:01:40 Operating system character set identified as UTF-8. Copyright (C) 1995, 2016, Oracle and/or its affiliates. All rights reserved. GGSCI (edvmr1p0) 1> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING GGSCI (edvmr1p0) 2> edit param rmongo REPLICAT rmongo TARGETDB LIBFILE libggjava.so SET property=dirprm/mongo.properties REPORTCOUNT EVERY 1 MINUTES, RATE GROUPTRANSOPS 1000 MAP OGGSRC.*, TARGET OGGSRC.*; :wq GGSCI (edvmr1p0) 3> add replicat rmongo, exttrail ./dirdat/md REPLICAT added. GGSCI (edvmr1p0) 4> start rmongo Sending START request to MANAGER ... REPLICAT RMONGO starting GGSCI (edvmr1p0) 5> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING RMONGO 00:00:00 00:00:00 GGSCI (edvmr1p0) 6>
Verify
You can verify the replication by insertign data on Oracle and see if that data was replicated.
Insert Data in Oracle
[oracle@edvmr1p0 oggsrc]$ sqlplus oggsrc/oracle@orcl SQL*Plus: Release 12.1.0.2.0 Production on Thu Nov 12 17:24:17 2020 Copyright (c) 1982, 2014, Oracle. All rights reserved. Last Successful login time: Thu Nov 12 2020 16:56:59 +00:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> insert into customer_prod select * from customer where customer_id > 1000 and customer_id < 4001; 3000 rows created. SQL> commit; Commit complete. SQL>
Check if the data was replicated through Golden Gate:
Verify Golden Gate replication
--Source GGSCI (edvmr1p0) 3> send priex, stats Sending STATS request to EXTRACT PRIEX ... Start of Statistics at 2020-11-12 17:24:47. Output to ./dirdat/in: Extracting from OGGSRC.CUSTOMER_PROD to OGGSRC.CUSTOMER_PROD: *** Total statistics since 2020-11-12 17:24:44 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 *** Daily statistics since 2020-11-12 17:24:44 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 *** Hourly statistics since 2020-11-12 17:24:44 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 *** Latest statistics since 2020-11-12 17:24:44 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 End of Statistics. --Destination GGSCI (edvmr1p0) 7> send rmongo,stats Sending STATS request to REPLICAT RMONGO ... Start of Statistics at 2020-11-12 17:24:56. Replicating from OGGSRC.CUSTOMER_PROD to OGGSRC.CUSTOMER_PROD: *** Total statistics since 2020-11-12 17:24:48 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 *** Daily statistics since 2020-11-12 17:24:48 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 *** Hourly statistics since 2020-11-12 17:24:48 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 *** Latest statistics since 2020-11-12 17:24:48 *** Total inserts 3000.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 3000.00 End of Statistics. GGSCI (edvmr1p0) 8>
Now, we can check the mongo database, if it has received the data.
Verify Mongo
[oracle@edvmr1p0 oggtrg]$ mongo MongoDB shell version v3.4.1 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.4.1 Server has startup warnings: 2020-11-12T17:09:09.009+0000 I STORAGE [initandlisten] 2020-11-12T17:09:09.009+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 2020-11-12T17:09:09.009+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem 2020-11-12T17:09:09.897+0000 I CONTROL [initandlisten] 2020-11-12T17:09:09.897+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2020-11-12T17:09:09.897+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2020-11-12T17:09:09.897+0000 I CONTROL [initandlisten] > show dbs OGGSRC 0.000GB admin 0.000GB local 0.000GB > use OGGSRC switched to db OGGSRC > show collections CUSTOMER_PROD > db.CUSTOMER_PROD.find().pretty() { "_id" : "1001", "EMAIL_ADDRESS" : "[email protected]", "CITY" : "Calle Blancos", "ZIP_CODE" : "70615", "ADDRESS" : "P.O. Box 254, 3617 Non Rd.", "CUSTOMER_TYPE" : NumberLong(6), "CUSTOMER_ID" : NumberLong(1001), "LAST_NAME" : "Vega", "FIRST_NAME" : "Alisa", "SSN" : "16840904-6045" }