0. Env list:
Oracle Linux:6.10
Oracle DB 11.2.0.4
OGG4Ora:19.1
OGG4BD:19.1

1.Install package for OCI instance:
yum groupinstall "X Window System"
yum install oracle-rdbms-server-11gR2-preinstall
Yum install java
yum -y groupinstall kde-desktop
yum install -y java-1.8.0-openjdk.x86_64
yum install tiger-vncserver
https://scriptingmysql.wordpress.com/2019/11/22/how-to-setup-a-gui-via-vnc-for-your-oracle-linux-compute-instance-in-oracle-cloud-infrastructure-oci/

2.OS Configuration

a.service iptables stop

b.profile:
#!/bin/bash
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
export JAVA_HOME=/usr/java/latest
export JRE_HOME=/usr/java/latest/jre
PATH=$JAVA_HOME/bin:$ORACLE_HOME/bin:$PATH ; export PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$JAVA_HOME/lib:
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/ogg4ora/jdk/jre/lib/amd64/server/:/lib:/usr/lib; export LD_LIBRARY_PATH
alias db='sqlplus ogg/ogg'
alias sys='sqlplus / as sysdba'
alias ggsci='/u01/ogg4ora/ggsci'
alias ggbd='/u01/ogg4bd/ggsci'

c.java -version
[oracle@instance-20191126-0838 kafka_2.12-2.3.0]$ java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
d.Ingress Rules:
Open ports for :5901,1521,7909,7819,2181,9092

3. Enable OGG for Oracle DB 11.2.0.4

a.源端数据库打开Archive Log:
SQL>shutdown immediate;
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;
SQL>archive log list;

b.源端数据库打开数据库级最小附加日志及force logging:
SQL>SELECT supplemental_log_data_min, force_logging FROM v$database;
SQL>alter database add supplemental log data;
SQL>alter database force logging;
切换日志以使附加日志生效:
SQL>ALTER SYSTEM switch logfile;

c.Enabling Oracle GoldenGate in the Database:
SQL> show parameter enable_goldengate_replication
SQL> alter system set Enable_goldengate_replication = true scope=both;

d.在源端创建用户并授权
e.在源端数据库创建GoldenGate用户:
SQL> create user ogg identified by ogg;
SQL>GRANT DBA to ogg;
SQL> BEGIN
dbms_goldengate_auth.grant_admin_privilege
(
grantee => 'ogg',
privilege_type => 'CAPTURE',
grant_select_privileges => TRUE
);
END;
/

4.OGG Settings:
a.OGG4Ora
OGG Home:/u01/ogg4ora
b.Extract:
extract extora
userid ogg@orcl, password ogg
exttrail ./dirdat/tm
table hr.*;

c.Pump:
extract pumora
passthru
rmthost <ip>, mgrport 7909
rmttrail ./dirdat/pn
table hr.*;

d.Mgr:
port 7809

e.Groups adding:
在OGG中添加表级附加日志
GGSCI>dblogin userid ogg password ogg
GGSCI>add trandata hr.* ALLCOLS

GGSCI>create subdirs
GGSCI>add extract extora,tranlog,begin now
GGSCI>add exttrail ./dirdat/tm,extract extora,megabytes 10
GGSCI>info extract extora
GGSCI> add extract pumora,exttrailsource ./dirdat/tm
GGSCI> add rmttrail ./dirdat/pn,extract pumora,megabytes 10

f.OGG4BD
OGG Home: /u01/ogg4bd/
g.Add /u01/ogg4ora/jdk/jre/lib/amd64/server/ into LD_LIBRARY_PATH.
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/ogg4ora/jdk/jre/lib/amd64/server/:/lib:/usr/lib; export LD_LIBRARY_PATH

h.Copy 3 sample file from /u01/ogg4bd/AdapterExamples/big-data/kafka to OGG Home/dirprm
They are kafka.props ,custom_kafka_producer.properties and rkafka.prm
i:And edit:kafka.props
cat kafka.props

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=ogg_topic
#The following selects the message key using the concatenated primary keys
#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.MetaHeaderTemplate=${alltokens}
gg.handler.kafkahandler.format.insertOpKey = I
gg.handler.kafkahandler.format.updateOpKey = U
gg.handler.kafkahandler.format.deleteOpKey = D

goldengate.userexit.writers=javawriter
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/:/u01/kafka/kafka_2.12-2.3.0/libs/*:/u01/ogg4bd/:/u01/ogg4bd/lib/*
#Sample gg.classpath for HDP
#gg.classpath=/etc/kafka/conf:/usr/hdp/current/kafka-broker/libs/*

javawriter.bootoptions=-Xmx512m -Xms32m -Djava.class.path=ggjava/ggjava.jar

j.custom_kafka_producer.properties:
[oracle@instance-20191126-0838 dirprm]$ cat custom_kafka_producer.properties
bootstrap.servers=localhost:9092
acks=1
reconnect.backoff.ms=1000

value.serializer=org.apache.kafka.common.serialization.ByteArraySerializer
key.serializer=org.apache.kafka.common.serialization.ByteArraySerializer
# 100KB per partition
batch.size=16384
linger.ms=10000

k.Replicat:
GGSCI (instance-20191126-0838) 3> view param RKAFKA

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 HR.*, TARGET HR.*;

l:GGSCI (instance-20191126-0838) 1> view param ./GLOBALS

CHECKPOINTTABLE ogg.chkpt
GGSCI> dblogin userid ogg,password ogg;
GGSCI>add CHECKPOINTTABLE ogg.chkpt
m:Group adding:
add replicat kc, exttrail /u01/ogg4bd/dirdat/tr

https://dongkelun.com/2018/05/23/oggOracle2Kafka/

5.Kafka install:
a. Download the image:
wget http://mirrors.hust.edu.cn/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz
b.tar -xzf kafka_2.12-2.3.0.tgz
c. Start the ZooKeeper and Kafka Server
https://kafka.apache.org/quickstart
Change directory to Kakfa Home:
/u01/kafka/kafka_2.12-2.3.0

Step 1: Start the server

Kafka uses ZooKeeper so you need to first start a ZooKeeper server if you don't already have one. You can use the convenience script packaged with kafka to get a quick-and-dirty single-node ZooKeeper instance.

> bin/zookeeper-server-start.sh config/zookeeper.properties

Step 2:Now start the Kafka server:

> bin/kafka-server-start.sh config/server.properties

Step 3: Create a test topic (Optional)
Let's create a topic named "test" with a single partition and only one replica:

> bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
We can now see that topic if we run the list topic command:

> bin/kafka-topics.sh --list --bootstrap-server localhost:9092
test
Step 4: Consume the Kafka topic

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic oggtopic --from-beginning

HR_REP▒V
{"table":"HR.JOBS","op_type":"U","op_ts":"2019-11-26 07:42:09.000394","current_ts":"2019-11-26T07:42:14.039000","pos":"00000000010000002592","before":{"JOB_ID":"HR_REP","JOB_TITLE":"Human Resources Representative","MIN_SALARY":5555,"MAX_SALARY":9000},"after":{"JOB_ID":"HR_REP","MIN_SALARY":666}}

./kafka-server-start.sh ../config/server.properties

./zookeeper-server-start.sh -daemon zookeeper.properties

Oracle GoldenGate for BigData-Kafka的更多相关文章

  1. Oracle GoldenGate mysql To Kafka上车记录

    一.前言 首先要学习一下ogg的所有进程,看着这张图来学习   Manager进程是GoldenGate的控制进程,运行在源端和目标端上.它主要作用有以下几个方面:启动.监控.重启Goldengate ...

  2. Oracle GoldenGate对接 Oracle 11g和Kafka

    本文主要是向读者介绍如何通过 ogg 为 oracle 数据库的变更操作实时同步到大数据产品 kafka 上. 开始介绍前,先为读者介绍一下环境背景 机器ip 和其对应的服务 192.168.88.1 ...

  3. Streaming data from Oracle using Oracle GoldenGate and Kafka Connect

    This is a guest blog from Robin Moffatt. Robin Moffatt is Head of R&D (Europe) at Rittman Mead, ...

  4. Oracle GoldenGate to Confluent with Kafka Connect

    Confluent is a company founded by the team that built Apache Kafka. It builds a platform around Kafk ...

  5. Oracle GoldenGate部署系列

    在之前,为了某个项目,研究ogg 如何安装部署,已经对接大数据产品. 因为网上的很多资料都讲得不仔细,或者是版本对应不上,所以在部署时,遇到了非常多的困难. 作者根据自己的经验,录制了OGG整套部署和 ...

  6. Oracle Goldengate是如何保证数据有序和确保数据不丢失的?

    工作中一直在用Oracle 的中间件Oracle GondenGate 是如何保证消息的有序和不丢失呢? Oracle GoldenGate逻辑架构 首先,先看一下Oracle GoldenGate ...

  7. Oracle GoldenGate 同步数据至Hbase

    该方法没试过,先记下再说 1.软件版本说明: Goldengate 12c 12.2.0.1 for Oracle(源端) Goldengate 12c 12.3.0.1 for Bigdata (目 ...

  8. Oracle GoldenGate 19.1新特性

    1.GoldenGate 19.1 新特性概览a.支持Oracle数据库19.1 长期支持发布版本.集成Oracle GoldenGate 12.3版的最终补丁集更新.b.微服务的安全性和可管理性增强 ...

  9. Oracle Goldengate REPLICAT启动时报正在运行解决办法

    stop replicate时报ERROR: opening port for REPLICAT MYREP (TCP/IP error: Connection refused). start rep ...

随机推荐

  1. asp dotnet core 从 Frp 获取用户真实 IP 地址

    我在本地开一个服务,然后通过 Frp 让小伙伴可以在外网访问我的 API 连接,但是直接通过 RemoteIp 拿到的是本地的地址.本文告诉小伙伴如何通过 Frp 可以拿到用户的真实 IP 地址 我写 ...

  2. dotnet 动态代理魔法书

    看到标题的小伙伴是不是想知道什么是魔法书,如果你需要写一段代码,这段代码是在做神奇的业务,只有你查询到了魔法书你才能找到这个对象,同时你还需要实现自己的接口,通过自己实现的接口调用才能用到有趣的方法 ...

  3. ant design 的Table组件固定表头时不对齐

    现在有一个表格,里面的列数是不固定的(可以重复写入数据),且列数行数都可能很多,就带来一个问题: 必须要固定表头,但是antd 的表格组件设置了固定表格 scroll={{x:1000,y:300}} ...

  4. SpringBoot Starter机制 - 自定义Starter

    目录 前言 1.起源 2.SpringBoot Starter 原理 3.自定义 Starter 3.1 创建 Starter 3.2 测试自定义 Starter 前言         最近在学习Sp ...

  5. JAVA优化篇 如何找到运行缓慢的线程

    引入 JAVA提供了一些分析DUMP的工具,比如jmap,visualvm 等 JAVA还有寻找线程状态的工具,jstack等 数据库也有检查连接数,连接状态的命令,status,processlis ...

  6. 洛谷$P3302$ 森林 $[SDOI2013]$ 主席树

    正解:主席树 解题报告: 传送门! 口胡一时爽代码火葬场 这题想法不难,,,但显然的是代码应该还挺难打的 但反正我也不放代码,就写下题解趴$QwQ$ 第一问就是个$Count\ on\ a\ tree ...

  7. JDK1.8中的HashMap实现

    1.HashMap概述 在JDK1.8之前,HashMap采用数组+链表实现,即使用链表处理冲突,同一hash值的节点都存储在一个链表里.但是当位于一个桶中的元素较多,即hash值相等的元素较多时,通 ...

  8. [Oracle]Oracle的闪回归档

    Oracle的闪回归档 场景需求,由于管理数据库的一些核心表,在实施初期会有人为误删除的问题.Oracle 11gR2提供了闪回归档的特性,可以保证不用RMAN来恢复误删除的数据.实践如下: 1.创建 ...

  9. 如何在Pypi发布上传你自己的Python库

    Pypi上传包 准备 Windows环境 *以下教程只能在Windows上执行,MACOS系统不能使用 注册账号 你需要在Pypi上注册一个账号. 安装必要的库 setuptools 原则上安装了pi ...

  10. 导出 CVS

    function ExportStoreInfoAction() { set_time_limit(0); $table = "xd_store"; $res = [[...].. ...