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. CSS多余文本省略号显示

    CSS多余文本省略号显示 本次案例代码是在 elementui 当中的 table 组件中实际需求 当然使用的是纯 CSS3 代码,所以原生支持度高,兼容性高,所以可多场景应用 对于过长文本进行单行省 ...

  2. vue-learning:40 - Vuex - 第一篇:概念和基本使用

    vuex 第一篇 目录 vuex概念 state / mapState getter / mapGetter mutation / mapMutation action / mapAction mod ...

  3. 【50.54%】【BZOJ 1879】[Sdoi2009]Bill的挑战

    Time Limit: 4 Sec  Memory Limit: 64 MB Submit: 649  Solved: 328 [Submit][Status][Discuss] Descriptio ...

  4. ZR普转提2

    ZR普转提2 A 谢谢刁神教我A题 刚开始读错题了,以为是一个不可做的数位DP,然后就暴力滚粗 直到问了问刁神,发现自己题意是错的 然后成了比较简单的题目 直接暴力枚举每一位填什么,剩下的位数的数字都 ...

  5. 使用 AT 指令进行 Socket 通信

    BC26 支持使用 Socket 进行 TCP 和 UDP 协议通信,这两个协议也是 BC26 支持的众多通信协议的基础.本文讲解如何使用这两个协议与服务器端进行通信.在学习这篇文章前,请首先使用AT ...

  6. 金蝶handler中 collection 代码片段理解

    1,AtsOverTimeBillBatchEditHandler中collection的理解 SelectorItemCollection selectors = new SelectorItemC ...

  7. 【Python系统学习02】数据类型与类型转换

    一.数据类型 字符串 整数 浮点数 [补充中...] 1.字符串 str 字符串:英文string,简写str. name = '小石头:' print(name,'2019', '12', '24' ...

  8. Google Vision OCR

    Google Vision OCR 爬坑建议 首先安装 Google Vision shell composer require google/cloud-vision 第一次使用的时候真的遇到的问题 ...

  9. MyBatis原理-架构流程

    一 .MyBatis原理架构图 Mybatis的功能架构分为三层: API接口层:提供给外部使用的接口API,开发人员通过这些本地API来操纵数据库.接口层一接收到调用请求就会调用数据处理层来完成具体 ...

  10. Markdown数学符号

    上标 语法: x^2 效果: \(x^2\) 下标 语法: x_i 效果: \(x_i\) 整体 语法: x^{2y} 效果: \(x^{2y}\) 大括号 语法: \{\} 效果: \(\{\}\) ...