其他
OGG 微服务部署指南
Editor's Note
非常不错的 OGG 微服务部署指南,最近也在学习使用 OGG,对微服务架构有了一个基础的了解。下面一起学习具体的部署实施过程。
The following article is from IT那活儿 Author 张雷员
PART1
ogg微服务部署
1. 创建部署用户
groupadd -g 1000 oinstall
groupadd -g 1200 dba
useradd -u 1101 -g oinstall -G dba -d /home/oracle oracle
2. 部署目录
一个是OGG_HOME,软件安装路径与经典架构保持一致,简称MA; 一个是服务管理路径,微服务架构采用服务方式管理,简称SM,可以管理多个部署.例如for oracle 11g、oracle 12c等; 一个是部署路径,微服务采购云操作方式,所有部署与管理都是通过web其中管理,简称DEPLOY。
mkdir -p /oracle/app/ogg/db19.3/ogg191_ma
mkdir -p /oracle/app/ogg/db19.3/ogg191_sm
mkdir -p /oracle/app/ogg/db19.3/ogg191_deploy
chown oracle:oinstall /oracle/app/ogg/db19.3/ogg191_ma
chown oracle:oinstall /oracle/app/ogg/db19.3/ogg191_sm
chown oracle:oinstall /oracle/app/ogg/db19.3/ogg191_deploy
3. 部署软件(图形化)
./runInstaller
4. 部署软件(静默)
oracle.install.responseFileVersion=/oracle/install/rspfmt_ogginstall_response_schema_v21_1_0
INSTALL_OPTION=ORA21c
SOFTWARE_LOCATION=/oracle/app/ogg/db19.3/ogg191_ma
START_MANAGER=false
MANAGER_PORT=Not applicable for a Services installation.
DATABASE_LOCATION=Not applicable for a Services installation.
INVENTORY_LOCATION=/oracle/app/oraInventory
UNIX_GROUP_NAME=oinstall
./runInstaller -silent -showProgress -responseFile xxxx.rsp
5. 配置微服务
export OGG_HOME=/oracle/app/ogg/db19.3/ogg191_ma
export PATH=$PATH:$OGG_HOME/bin
oggca.sh
6. 验证微服务
netstat -anlp |grep 7809
1)通过网页登陆验证
http://192.168.xx.xxx:7809
# 密码为前面设置的密码 oggadmin/oracle
connect http://192.168.xx.xxx:7809 deployment deploy19c as oggadmin password oracle
Admin server: 用于创建用户、添加附加日志、创建抽取和投递进程,类似在ggsci命令下添加附加日志、extract、replicat进程; Distribution server:用于创建传输进程,类似于以前的pump进程; Receiver server:用于监控接收进程,类似于以前的server collector进程; Performance metrics server:性能监控,这个里面信息非常多,例如ADMINSRVR包括进程性能,线程性能以及进程状态与配置,非常详细与直观。
PART2
使用微服务配置数据同步
1. 数据库开归档
shu immediate ;
startup mount;
alter database archivelog ;
aechive log list ;
alter database open ;
2. 补充日志和force logging
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
alter database FORCE LOGGING;
set line 350 pages 999
col NAME for a15
col LOG_MODE for a15
col OPEN_MODE for a15
col PLATFORM_NAME for a25
col FORCE_LOGGING for a20
col SUPPLEMENTAL_LOG_DATA_MIN for a25
SELECT
NAME,
LOG_MODE,
OPEN_MODE,
PLATFORM_NAME,
FORCE_LOGGING,
SUPPLEMENTAL_LOG_DATA_MIN
FROM
V$DATABASE;
3. 创建ogg 表空间
set linesize 150
col FILE_NAME for a50
select tablespace_name ,file_name from dba_data_files;
select bytes/1024/1024 from v$log;
# 表空间不小于一个redo日志组大小
CREATE TABLESPACE goldengate DATAFILE '+DATA' size 1G autoextend on maxsize 10G;
4. 创建ogg抽取用户
CREATE USER GOLDENGATE IDENTIFIED BY goldengate DEFAULT TABLESPACE users TEMPORARY TABLESPACE TEMP;
GRANT CONNECT,RESOURCE TO GOLDENGATE container=all;
GRANT ALTER ANY TABLE TO GOLDENGATE container=all;
GRANT ALTER SESSION TO GOLDENGATE container=all;
GRANT CREATE SESSION TO GOLDENGATE container=all;
GRANT FLASHBACK ANY TABLE TO GOLDENGATE container=all;
GRANT SELECT ANY DICTIONARY TO GOLDENGATE container=all;
GRANT SELECT ANY TABLE TO GOLDENGATE container=all;
GRANT EXECUTE ANY TYPE TO GOLDENGATE container=all;
GRANT SELECT ANY TRANSACTION TO GOLDENGATE container=all;
GRANT CREATE any TABLE,CREATE any SEQUENCE TO GOLDENGATE container=all;
GRANT INSERT ANY TABLE TO GOLDENGATE container=all;
GRANT UPDATE ANY TABLE TO GOLDENGATE container=all;
GRANT DELETE ANY TABLE TO GOLDENGATE container=all;
GRANT CREATE ANY INDEX TO GOLDENGATE container=all;
grant unlimited tablespace to GOLDENGATE container=all;
grant execute on DBMS_FLASHBACK to GOLDENGATE container=all;
grant COMMENT ANY TABLE to GOLDENGATE container=all;
alter system set enable_goldengate_replication=true sid='*' scope=both;
exec dbms_goldengate_auth.grant_admin_privilege('GOLDENGATE') ;
5. 添加凭证
alter credentialstore add user goldengate@192.168.xx.xxx:1521/pdbprod1 alias oraprod DOMAIN oraprod;
INFO CREDENTIALSTORE DOMAIN oraprod
dblogin useridalias oraprod DOMAIN oraprod
6. 添加附加日志
add schematrandata pdbprod1.scott
info schematrandata pdbprod1.scott
8. 初始化数据
9. 添加复制进程
参数文件
--base parameter
REPLICAT rp_pdb2
USERIDALIAS oraprod DOMAIN oraprod
SOURCECATALOG pdbprod2
DISCARDFILE rp_pdb2.dsc,APPEND,MEGABYTES 100
DISCARDROLLOVER AT 3:00
DBOPTIONS INTEGRATEDPARAMS(parallelism 2)
DBOPTIONS SUPPRESSTRIGGERS
DBOPTIONS DEFERREFCONST
-- ASSUMETARGETDEFS
REPERROR DEFAULT, ABEND
REPORTCOUNT EVERY 60 MINUTES, RATE
REPORTROLLOVER AT 9:00
--map objects
MAP pdbprod1.scott.*, TARGET pdbprod2.scott.*;
--ddl map
DDL INCLUDE MAPPED
DDLOPTIONS REPORT
DDLERROR DEFAULT ABEND
DDLOPTIONS REPORT
--performance
DBOPTIONS INTEGRATEDPARAMS (COMMIT_SERIALIZATION DEPENDENT_TRANSACTIONS)
BATCHSQL
GROUPTRANSOPS 1000
添加复制
dblogin useridalias oraprod DOMAIN oraprod
add replicat rp_pdb2 integrated exttrail /oracle/app/ogg/db19.3/ogg191_deploy/var/lib/data/e2
start replicat rep_01, aftercsn <expdpd_scn>
web页面方式添加
10. 抽取和复制进程状态
本文作者:张雷员
本文来源:IT 那活儿(授权转载)
点击下方公众号“JiekeXu DBA之路”,欢迎关注、置顶我的公众号,一起学习新知识!
————————————————————————————
公众号:JiekeXu DBA之路
墨天轮:https://www.modb.pro/u/4347
CSDN :https://blog.csdn.net/JiekeXu
腾讯云:https://cloud.tencent.com/developer/user/5645107
————————————————————————————