您好,登錄后才能下訂單哦!
這篇文章主要介紹了如何使用OGG同步ORACLE ACTIVE DATAGUARD數據到CLOUDERA HBASE測試,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
環境介紹:
機器名 | 數據庫版本 | 架構 | OGG版本 | IP | OS版本 |
uatdbrac1 | Oracle 11.2.0.4 | rac | NULL | 172.16.49.191 | REDHAT6.4 |
Uatdbrac2 | Oracle 11.2.0.4 | rac | NULL | 172.16.49.193 | REDHAT6.4 |
uagracdg | Oracle 11.2.0.4 | ADG | OGG 12.2.0.1 | 172.16.49.138 | REDHAT6.4 |
master1 | Hbase | cdh6.6.0 | OGG FOR BIG DATA 12.2.0.1 | 172.16.49.35 | REDHAT6.4 |
測試目的:
以ORACLE ACTIVE DATAGUARD 作為數據抽取源,使用ORACLE GOLDENGATE將ORACLE數據庫中變化數據同步到HBASE集群。
一.部署ORACLE RAC的ACTIVE DATAGUARD
請參照之前ADG EXAMPLE 文檔
二.在主庫RAC上的準備工作
1. 創建GoldenGate表空間
2. 創建GoldenGate用戶并授權
3. 開啟force logging(做Active Datagurad時候已經配好)
4. 啟用附加日志
alter database add supplemental log data;
alter system switch logfile;
select supplemental_log_data_min from v$database;
5. 啟用enable_goldengate_replication
alter system set enable_goldengate_replication=true;
三.在ADG上部署goldengate 12.2
1. 創建golden os用戶
2. 創建ogg軟件安裝目錄 /goldengate/gg12c
3. 編輯golden用戶profile
Vi .bash_profile 添加如下內容:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=uatracdg --ACTIVE DATAGUARD ORACLE SID
export LD_LIBRARY_PATH=/goldengate/gg12c:$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export OGG_HOME=/goldengate/gg12c
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:/goldengate/gg12c:.
export PATH
cd $OGG_HOME
4. 下載goldengate 12.2 for linux 64bit版本
最新軟件包名 V100692-01.zip
5. 解壓安裝包
Unzip V100692-01.zip得到下列文件:
fbo_ggs_Linux_x64_shiphome
OGG-12.2.0.1.1-ReleaseNotes.pdf
OGG-12.2.0.1-README.txt
6. 編輯靜默安裝參數文件
cd /goldengate/fbo_ggs_Linux_x64_shiphome/Disk1/response
編輯response文件,更改下列參數
INSTALL_OPTION=ORA11g
SOFTWARE_LOCATION=/goldengate/gg12c
START_MANAGER=true
MANAGER_PORT=7801
DATABASE_LOCATION=/u01/app/oracle/product/11.2.0/dbhome_1
INVENTORY_LOCATION=/goldengate/gg12c/oraInventory
UNIX_GROUP_NAME=oinstall
7. 靜默安裝OGG
cd /goldengate/fbo_ggs_Linux_x64_shiphome/Disk1
./runInstaller -silent -responseFile /goldengate/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp
8. 添加表的附加日志
因為ADG是只讀模式,添加附加日志需要更改數據字典,所以此操作需要在ggsci命令行中連接主庫RAC進行
ggsci dblogin userid goldengate@uatrac passowrd
add trandata HADP.OGGT1
add trandata HADP.OGGT2
9. 添加配置extract進程
add extract ext01, tranlog, begin yyyy-MM-dd HH:mm:ss
add exttrail ./dirdat/et, extract ext01
edit param ext01
EXTRACT ext01
setenv ( NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" )
setenv ( ORACLE_SID=uatracdg )
userid goldengate, password golden123
exttrail ./dirdat/et
gettruncates
--dynamicresolution
discardfile ./dirrpt/discardext01.txt, append, megabytes 50
--DBOPTIONS ALLOWUNUSEDCOLUMN
--TRANLOGOPTIONS CONVERTUCS2CLOBS
EOFDELAY 3
getupdatebefores
TRANLOGOPTIONS MINEFROMACTIVEDG --FOR ADG
TABLE HADP.OGGT2;
TABLE HADP.OGGT1;
10. 添加配置PUMP進程
add extract pup1, exttrailsource ./dirdat/et
add rmttrail ./dirdat/rt, extract pup1
Edit param pup1
extract pup1
setenv ( NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" )
userid goldengate password golden123
rmthost 172.16.49.35, mgrport 7809, TCPBUFSIZE 5000000
rmttrail ./dirdat/rt
DYNAMICRESOLUTION
NUMFILES 3000
ALLOCFILES 200
passthru
TABLE HADP.OGGT2;
TABLE HADP.OGGT1;
四.在CDH上部署goldengate for big data 12.2
1. 創建golden os用戶
2. 創建ogg軟件安裝目錄 /goldengate/gg12c
3. 編輯golden用戶profile
export JAVA_HOME=/usr/local/jdk1.7.0_80
PATH=$PATH:$HOME/bin
export PATH
export NLS_LANG=AMERICAN_AMERICA.ZHS16BGK
export PATH=$JAVA_HOME/bin:$PATH:/goldengate/gg12c:/usr/local/apache-maven-3.1.1/bin:.
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server:/goldengate/gg12c:/goldengate/gg12c/ggjava/resources/ggplugins/hdfs:.
export CLASSPATH=/goldengate/gg12c/ggjava/*:/goldengate/gg12c/dirprm/*:/goldengate/gg12c/lib/*:/etc/hadoop/conf/core-site.xml:/etc/hadoop/conf/hdfs-site.xml:/opt/cloudera/parcels/
CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop-hdfs/*:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop-hdfs/lib/*:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop/*:/
opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop/client/*:/goldengate/gg12c/dirprm/*:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop/lib/*:.
export OGG_HOME=/goldengate/gg12c
4.下載ogg for big data
最新軟件包V100447-01.zip
5.安裝ogg for big data
解壓在安裝目錄即可
6.創建子目錄
Ggsci > create subdirs
7.配置管理進程MGR
Edit param mgr
PORT 7809
dynamicportlist 7820-7850
8.添加配置復制進程
將/goldengate/gg12c/AdapterExamples/big-data/hbase下文件copy到$OGG_HOME/dirprm下,
編輯hbase.props
更改下列參數
gg.handler.hbase.hBaseColumnFamilyName=ID
gg.classpath=/etc/hbase/conf.cloudera.hbase:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hbase/*:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hbase/lib/*:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop/*:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop/client/*:/goldengate/gg12c/dirprm/*:/opt/cloudera/parcels/CDH-5.6.0-1.cdh6.6.0.p0.45/lib/hadoop/lib/*:.
ggsci>add replicat rhbase, nodbcheckpoint, exttrail ./dirdat/rt
ggsci>Edit param rhbase
REPLICAT rhbase
SOURCEDEFS ./dirsql/hdfs.sql
-- Trail file for this example is located in "AdapterExamples/trail" directory
-- Command to add REPLICAT
-- add replicat rhbase, exttrail AdapterExamples/trail/tr
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
TARGETDB LIBFILE /goldengate/gg12c/libggjava.so SET property=/goldengate/gg12c/dirprm/hbase.props
REPORTCOUNT EVERY 1 MINUTES, RATE
GROUPTRANSOPS 10000
MAP HADP.OGGT2, TARGET HADP.OGGTEST,
RESOLVECONFLICT(INSERTROWEXISTS, (DEFAULT, OVERWRITE)),
COLMAP (ID=ID, COL1=COL1, COL2=COL2);
MAP HADP.OGGT1, TARGET HADP.OGGTEST,
RESOLVECONFLICT(INSERTROWEXISTS, (DEFAULT, OVERWRITE)),
COLMAP (ID=ID, COLA=COLA, COLB=COLB);
9.登陸HBASE創建測試表
創建namespace HADP:
hbase shell
create namespace ‘HADP’
list_namespace
describe_namespace ‘HADP’
創建表:
create ‘HADP:OGGTEST’,’ID’,’COL1’,’COL2’,’COLA’,’COLB’
查看表數據:
scan ‘HADP:OGGTEST’
10.查看OGG FOR BIG DATA日志
cd /goldengate/gg12c/dirrpt
more *hbase*.log
感謝你能夠認真閱讀完這篇文章,希望小編分享的“如何使用OGG同步ORACLE ACTIVE DATAGUARD數據到CLOUDERA HBASE測試”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。