ORACLE GOLDEN GATE oracle同步数据至kafka
一.服务器信息
| ip | 软件版本 | ogg版本 | 软件包 | 操作系统版本 | OGG安装路径 | |
| 10.1.50.52 | 源 | oracle11.2.0.4 | 12.2.0.1.1 | V100692-01.zip | centos6.9 | /data/ogg |
| 10.0.71.102 | 目标 | kafka0.10 | 12.2.0.1.160823 | 123010_ggs_Adapters_Linux_x64.zip | centos7.3 | /data/ogg |
二.源端安装OGG
1.解压V100692-01.zip
unzip V100692-.zip
这个时候会看到fbo_ggs_Linux_x64_shiphome文件夹
2.我们采用静默安装的方式进行安装(注意要使用oracle用户来进行安装,oggcore.rsp配置需要根据实际需要进行修改,也可使用图形界面进行安装)
/usr/local/software/fbo_ggs_Linux_x64_shiphome/Disk1/runInstaller -silent -responseFile /usr/local/software/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp
三.源端OGG配置
1.开启主库归档日志、补充日志及force logging
alter database add supplemental log data;
alter database force logging;
alter system set enable_goldengate_replication=true scope=both;
2.创建ogg的管理用户
create user ogg identified by password account unlock;
grant connect,resource to ogg;
grant select any dictionary to ogg;
grant select any table to ogg;
grant execute on utl_file to ogg;
grant restricted session to ogg;
grant create table,create sequence to ogg;
alter table DCSDBA.YH_ITF_INVENTORY_TRANSACTION add supplemental log data (all) columns;--如果kafka需要接收到完整的修改信息就需要开启补全日志
3.登录ogg并创建目录
/data/ogg/ggsci
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
create subdirs

4.配置源端manager进程
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
edit params mgr
port 1357
autostart er *
autorestart er *
5.启动
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
manager并确认状态
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
start mgr
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
info all 查看MANAGER进程为running状态
6.配置加密
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
ENCRYPT PASSWORD password ENCRYPTKEY
DEFAULT
7.配置数据抽取进程
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
①加一个extract,名字随便取
add extract hnwmsprd,tranlog,begin now
②为这个ext指定他把远程文件放到远程机的哪个目录
ADD RMTTRAIL /data/ogg/dirdat/tt, EXTRACT hnwmsprd
③编辑配置文件
edit params hnwmsprd
extract hnwmsprd
setenv
(NLS_LANG="AMERICAN_AMERICA.UTF8")
setenv
(ORACLE_SID="hnwmsprd")
userid ogg,password AACAAAAAAAAAAAKALILFJIXIECMGKFAHRBJHGDGBNJLBOAUC,ENCRYPTKEY
DEFAULT
rmthost 10.0.71.102, mgrport 1357
rmttrail /data/ogg/dirdat/tt
discardfile /data/ogg/dirrpt/trail.dsc,append,megabytes
100
gettruncates
GETUPDATEBEFORES
NOCOMPRESSDELETES
NOCOMPRESSUPDATES
TRANLOGOPTIONS MINEFROMACTIVEDG
table DCSDBA.YH_ITF_INVENTORY_TRANSACTION;
④启动进程
start hnwmsprd
四.OGG目标端搭建
目标端搭建只需解压软件即可
unzip 123010_ggs_Adapters_Linux_x64.zip
解压出来ggs_Adapters_Linux_x64.tar文件
将文件移动到/data/ogg目录下解压
mv ggs_Adapters_Linux_x64.tar /data/ogg
tar -xvf ggs_Adapters_Linux_x64.tar
五.OGG目标端配置
1.登录ogg并创建目录
/data/ogg/ggsci
create subdirs
2.配置源端manager进程
edit params mgr
port 1357
autostart er *
autorestart er *
3.启动manager并确认状态
start mgr
info all 查看MANAGER进程为running状态
4.添加复制进程
add replicat rkafka,exttrail dirdat/tt,begin now
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
edit params rkafka
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
REPLICAT rkafka
TARGETDB LIBFILE libggjava.so SET
property=dirprm/kafka.props
REPORTCOUNT EVERY 1 MINUTES, RATE
GROUPTRANSOPS 10000
MAP DCSDBA.YH_ITF_INVENTORY_TRANSACTION,
TARGET DCSDBA.YH_ITF_INVENTORY_TRANSACTION;
5.修改kafka.props(注意:kafka.props要放在/data/ogg/dirprm路径下)
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
gg.handlerlist = kafkahandler
gg.handler.kafkahandler.type = kafka
gg.handler.kafkahandler.KafkaProducerConfigFile=custom_kafka_producer.properties
gg.handler.kafkahandler.TopicName =hnwmsprd
gg.handler.kafkahandler.format =json
gg.handler.kafkahandler.SchemaTopicName=ogg
gg.handler.kafkahandler.BlockingSend
=true
gg.handler.kafkahandler.includeTokens=false
gg.handler.kafkahandler.mode =tx
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=dirprm/:/usr/local/kafka/libs/*:
javawriter.bootoptions=-Xmx512m
-Xms32m -Djava.class.path=ggjava/ggjava.jar
以上配置文件根据实际配置进行修改
6.编辑custom_kafka_producer.properties文件(注意:custom_kafka_producer.properties要放在/data/ogg/dirprm路径下)
#bootstrap.servers=host:port
bootstrap.servers=10.0.71.102:9092
acks=1
#compression.type=gzip
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=102400
linger.ms=10000
7.启动复制进程
start
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
rkafka
六.验证
目标端执行
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
./kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic hnwmsprd
源端更新DCSDBA.YH_ITF_INVENTORY_TRANSACTION表。
如果是在adg作为源端需要在源抽取进程上添加参数
TRANLOGOPTIONS MINEFROMACTIVEDG
并在主库开启ddl,可以参考下面这位大神的配置
http://czmmiao.iteye.com/blog/1609823
Normal
0
7.8 磅
0
2
false
false
false
EN-US
ZH-CN
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
ORACLE GOLDEN GATE oracle同步数据至kafka的更多相关文章
- OGG 从Oracle备库同步数据至kafka
OGG 从Oracle备库同步数据至kafka Table of Contents 1. 目的 2. 环境及规划 3. 安装配置JDK 3.1. 安装jdk 3.2. 配置环境变量 4. 安装Data ...
- 转://Oracle Golden Gate 概念和原理
引言:Oracle Golden Gate是Oracle旗下一款支持异构平台之间高级复制技术,是Oracle力推一种HA高可用产品,简称“OGG”,可以实现Active-Active 双业务中心架构 ...
- Oracle Golden Gate原理简介
Oracle Golden Gate原理简介 http://www.askoracle.org/oracle/HighAvailability/20140109953.html#6545406-tsi ...
- Oracle Golden Gate概要
Oracle GoldenGate简介 Oracle Golden Gate用于源数据库与目标数据库的数据复制备份:可以在异构的环境(各种操作系统和数据库)之间实现数据亚秒级的实时复制备份:以及可以在 ...
- Oracle Golden Gate - 概念和机制 (ogg)
Golden Gate(简称OGG)提供异构环境下交易数据的实时捕捉.变换.投递. OGG支持的异构环境有: OGG的特性: 对生产系统影响小:实时读取交易日志,以低资源占用实现大交易量数据实时复制 ...
- [转载]Oracle Golden Gate - 概念和机制 (ogg)
出处:https://www.cnblogs.com/qiumingcheng/p/5435907.html Golden Gate(简称OGG)提供异构环境下交易数据的实时捕捉.变换.投递. OGG ...
- Sybase to Oracle Golden Gate
Sybase 安装Golden Gate: 下载,然后create subdirs.并且在两端配置好mgr,设置好端口7809 创建golden gate用户ogguser,并且给它授权sa和repl ...
- Oracle Golden Gate基本配置
>> from zhuhaiqing.info [oracle@localhost ogg]$ cat ~/.bash_profile GG_HOME=/opt/oggPATH=$PATH ...
- 【GoldenGate】使用OGG,两个Oracle库之间单向同步数据
************************************************************************ ****原文:blog.csdn.net/clark_ ...
随机推荐
- JavaScript中实现DI的原理
什么是依赖注入 按照上面图的流程中我们可以知道我们需要实现这么几件事: 提供一个服务容器 为目标函数注册需要的依赖 获取目标函数注册的依赖项 通过依赖项来查询对应服务 将获取的依赖项传入目标函数 提供 ...
- pymsql模块使用
数据库连接客户端 链接:https://pan.baidu.com/s/1pM0h4SV 密码:614v sql指令基本用法:
- [uva] 10099 - The Tourist Guide
10099 - The Tourist Guide 题目页:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemi ...
- update_dctcp_alpha
/* + * Update dctcp alpha based on the ecn bit in the received packet. + * This procedure is called ...
- 你所不知道的C和C++运行库 标签: vc 2017-05-26 10:33 41人阅读 评论(0) 收藏
在使用vs2013调用vc2005编译出的dll时出现错误,遂将源程序用vs2013编译出dll,再用vs2013调用错误消失,不解.寻找原因时有人说"VC库版本不一样",故查找C ...
- windows生成硬链接
因工作电脑需要同时使用pl/sql和toad工具需要同时配置32位和64位oracle client如此增加了维护tnsnames.ora的复杂程度使用windows硬链接可以减少工作量,每次只修改源 ...
- Centos大文件切割和合并
现在很多公司都会把项目放在云服务器上,当我想把云服务器里面的代码和生成的文件 “sz 文件名称” down下来的时候,发现太大.云服务器不支持下载很大的文件.那么这种情况就需要使用split命令切割文 ...
- SAP S/4HANA里如何创建Customer主数据以及执行后续处理
来自Jerry的同事Zhang Sean. 1, Launch tcode: BP and select the Organization 2, Maintain the information fo ...
- 从0开始学CentOS7(2)---安装mariaDB、jdk1.8、redis
继续前面的基础步骤~ 这个是centos7自带的数据库MariaDB,以前是mysql,到7以后,改为MariaDB... 1. MariaDB安装,没有往深处配置...懒得动了..参考:http:/ ...
- SOA架构
基于服务的SOA架构_后续篇 今天是元宵节,首先祝各位广大博友在接下来的光阴中技术更上一层,事事如意!(没能在元宵节发布,今天就补上吧) 昨天简单介绍了一下本人在近期开发过的一个电商购物平台的架构 ...