Extract/Unzip GoldenGate for Big data,Java1.8 and kafka_2.12-2.2.1 into separate directories.
Configure JAVA_HOME and LD_LIBRARY_PATH export JAVA_HOME=<Path_To_Java1.8_Directory>/jdk1.8.0_202 export LD_LIBRARY_PATH<Path_To_Java1.8_Directory>/jre1.8.0_202/lib/amd64/server:$JAVA_HOME/lib
Traverse to the GoldenGate for Big Data directory and login into the ggsci prompt Edit the parameter file of manager and specify the manager PORT, Save and close it Edit params mgr PORT 7809 Start mgrNow, we need to set up the target on Azure.
From the Azure portal, Navigate to All Services and select Event Hubs and follow the steps mentioned in the below link to setup an Event Hub Namespace https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create. And make sure you select the Standard option under Pricing Tier as Basic option doesn’t allow Kafka to be enabled for the Event Hub.
Go Back to the GoldenGate directory, Traverse to AdapterExamplesàbig-data-àKafka And copy sample rkafka.prm, custom_producer.properties and kafka.props file to GoldenGate dirprm directory.
Open the rkafka.prm file and change the MAP/TARGET schema name according to the schema name at the source database. For testing, we are using the sample config trail and parameter file REPLICAT rkafka — Trail file for this example is located in “AdapterExamples/trail” directory — Command to add REPLICAT — add replicat rkafka, exttrail AdapterExamples/trail/tr TARGETDB LIBFILE libggjava.so SET property=dirprm/kafka.props REPORTCOUNT EVERY 1 MINUTES, RATE GROUPTRANSOPS 10000 MAP QASOURCE.*, TARGET QASOURCE.*;
Add the replicat using the following command- add replicat rkafka, exttrail <Trail_file_path_from_Source> For testing, you can use the sample trail file that comes with the GoldenGate binaries- add replicat rkafka, exttrail AdapterExamples/trail/tr
Open the Kafka props file and change the gg.classpath to the correct kafka installation directory path under #Sample gg.classpath for Apache Kafka. gg.handlerlist = kafkahandler gg.handler.kafkahandler.type=kafka gg.handler.kafkahandler.KafkaProducerConfigFile=custom_kafka_producer.properties #The following resolves the topic name using the short table name gg.handler.kafkahandler.topicMappingTemplate=${tableName} #The following selects the message key using the concatenated primary key gg.handler.kafkahandler.keyMappingTemplate=${primaryKeys} gg.handler.kafkahandler.format=json #gg.handler.kafkahandler.SchemaTopicName=mySchemaTopic gg.handler.kafkahandler.BlockingSend =false gg.handler.kafkahandler.includeTokens=false gg.handler.kafkahandler.mode=op #gg.handler.kafkahandler.metaHeadersTemplate=${alltokens} gg.handler.kafkahandler.transactionsEnabled=false auto.create.topics.enable=TRUE goldengate.userexit.writers=javawrite javawriter.stats.display=TRUE javawriter.stats.full=TRUE gg.log=log4j gg.log.level=INFO gg.report.time=30sec #Sample gg.classpath for Apache Kafka gg.classpath=dirprm/:/home/oracle/kafkalibs/kafka_2.12-2.2.1/libs/* javawriter.bootoptions=-Xmx512m -Xms32m -Djava.class.path=ggjava/ggjava.jar
13. Make changes to custom_producer.properties file, by adding your EventHUB connect string and password needed to connect to Azure Event hub
14. Login into your GoldenGate instance and start the Replicat process-
./ggsci
Start rkafka
15. Now check the Statistics for the Replicat by using the stats command-
16. Note that the topics are created automatically based on the table name in Azure Event Hub, as we have set gg.handler.kafkahandler.topicMappingTemplate=${tableName} .
17. Check the stats/Incoming Messages on the Azure Portal (Event Hub)-
Content contributed by Mr. Shrinidhi Kulkarni, Senior Solution Engineer, Solution Engineering NA Technology, Oracle
Authors
Thomas Vengal
Director, Product Management
Thomas Vengal is Director of Product Management at Oracle. Previously, he worked at Informatica as a product manager and development manager at HP Software. He has been working in the application and data management domain for over 15 years. He holds M.Tech in Data Science from BITS Pilani and an MBA from Perth Graduate School of Business.
LinkedIn Profile: https://www.linkedin.com/in/vengal/