OGG Director监控OGG运行状态并发送告警邮件
Oracle GoldenGate Director可以简化GoldenGate的监控和管理,可以通过图形界面或者web浏览器方便快捷的维护整个环境中的GoldenGate组件。OGG Director是部署在Oracle的中间件Weblogic Server上的Web应用,OGG Director可以安装在任何机器上,可以管理远程的OGG实例,远程的OGG实例不需要做任何的额外操作。
一、从Docker Hub或阿里云下载小麦苗上传的镜像文件
- 小麦苗的Docker Hub的地址:https://hub.docker.com/u/lhrbest
- OGG Director的地址:https://hub.docker.com/r/lhrbest/lhroggdirector
# 下载镜像
docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/lhroggdirector:3.0
# 打tag
docker tag registry.cn-hangzhou.aliyuncs.com/lhrbest/lhroggdirector:3.0 lhrbest/lhroggdirector:3.0
执行过程:
[root@docker36 ~]# docker search lhrogg
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
lhrbest/lhroggdirector 基于CentOS 7.6.1810,安装了远程桌面xrdp和Xfc… 1
[root@docker36 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/lhroggdirector:3.0
3.0: Pulling from lhrbest/lhroggdirector
5ff999edc5fc: Already exists
5ff4a6691229: Already exists
fe95c761b383: Already exists
82629c68c1e1: Pull complete
Digest: sha256:a94a2c46094cb2c76b4b24ee8f1791b729c06cc5588ea18f4617e4fd88fb92a6
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/lhrbest/lhroggdirector:3.0
registry.cn-hangzhou.aliyuncs.com/lhrbest/lhroggdirector:3.0
[root@docker36 ~]# docker tag registry.cn-hangzhou.aliyuncs.com/lhrbest/lhroggdirector:3.0 lhrbest/lhroggdirector:3.0
[root@docker36 ~]#
[root@docker36 ~]#
[root@docker36 ~]#
二、创建容器并启动OGG Director
用到的命令:
# 创建容器
docker run -d --name lhroggdirector -h lhroggdirector \
-p 230:22 -p 7001-7050:7001-7050 -p 7051:25 -p 7052:110 -p 7053:143 \
--privileged=true \
lhrbest/lhroggdirector:3.0 /usr/sbin/init
# 进入容器
docker exec -it lhroggdirector bash
# 添加域名解析
vi /etc/hosts
172.17.0.3 lhroggdirector mail.lhr.com
# 启动数据库
systemctl start mysql
# 启动weblogic
nohup /u01/ogg/Oracle/GG_Directorgg-director/domain/startWebLogic.sh &
# 网页登陆
http://192.168.1.36:7001/acon/
admin/admin
远程mstsc登陆: 192.168.1.35:7050
用户名和密码:root/lhr
# 客户端设置
/u01/ogg/Oracle/GoldenGateDirector/bin/run-admin.sh
/u01/ogg/Oracle/GoldenGateDirector/bin/run-director.sh
执行过程:
[root@docker36 ~]# docker run -d --name lhroggdirector -h lhroggdirector \
> -p 230:22 -p 7001-7050:7001-7050 -p 7051:25 -p 7052:110 -p 7053:143 \
> --privileged=true \
> lhrbest/lhroggdirector:3.0 /usr/sbin/init
5b701278db714cae9aba882a8081ca576c7d361557f592f9f51970019d299a1f
[root@docker36 ~]# docker exec -it lhroggdirector bash
[root@lhroggdirector /]# vi /etc/hosts
[root@lhroggdirector /]# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 lhroggdirector mail.lhr.com
[root@lhroggdirector /]# systemctl start mysql
[root@lhroggdirector /]# systemctl status mysql
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
Active: active (running) since Mon 2020-09-14 11:20:41 CST; 1min 12s ago
Docs: man:systemd-sysv-generator(8)
Process: 153 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
CGroup: /docker/5b701278db714cae9aba882a8081ca576c7d361557f592f9f51970019d299a1f/system.slice/mysqld.service
├─184 /bin/sh /usr/local/mysql//bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/lhroggdirector.pid
└─421 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql//lib/plugin --user=mysql --log-error=lhroggdirector.err --pid-file=/usr/local/mysql/data/lhroggdirector.pid --port=3306
Sep 14 11:20:41 lhroggdirector systemd[1]: Starting LSB: start and stop MySQL...
Sep 14 11:20:41 lhroggdirector mysqld[153]: Starting MySQL[ OK ]
Sep 14 11:20:41 lhroggdirector systemd[1]: Started LSB: start and stop MySQL.
[root@lhroggdirector /]# nohup /u01/ogg/Oracle/GG_Directorgg-director/domain/startWebLogic.sh &
[1] 604
[root@lhroggdirector /]# nohup: ignoring input and appending output to ‘nohup.out’
[root@lhroggdirector /]#
[root@lhroggdirector /]# tail -n 6 nohup.out
<Sep 14, 2020 3:22:25 AM UTC> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 172.17.0.2:7001 for protocols iiop, t3, ldap, snmp, http.>
<Sep 14, 2020 3:22:25 AM UTC> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
<Sep 14, 2020 3:22:25 AM UTC> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "localhost" for domain "domain" running in Development Mode>
<Sep 14, 2020 3:22:25 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Sep 14, 2020 3:22:25 AM UTC> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
<Sep 14, 2020 3:22:37 AM UTC> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 172.17.0.1:11,271 during the configured idle timeout of 5 secs>
[root@lhroggdirector /]#
日志最后显示“Server started in RUNNING mode”,表示启动正常。
三、登陆web
登录地址为:http://192.168.1.36:7001/acon/
用户名和密码都是admin
登陆之后为空页面:
四、添加待监控的OGG实例
4.1 登陆远程桌面
需要登陆远程桌面xrdp,本容器已安装,端口为7050,直接使用mstsc登陆即可。使用快捷键Windows+R键,然后输入mstsc即可:
登陆用户为root,密码为lhr
4.2 启动客户端界面
运行命令“/u01/ogg/Oracle/GoldenGateDirector/bin/run-admin.sh”调出director的客户端,输入用户名和密码都是admin,server为127.0.0.1:7001,如下图所示:
WU代表:Windows或Unix操作系统,其它参数大家都懂的。分别添加OGG源端和目标端,添加完成后,点击Save保存后,可以在web界面上看到效果:
在界面上可以执行很多操作,例如执行ggsci命令:
4.3 OGG 架构图形展示
通过这个工具可以用画图的方式配置golden gate,只要正确的配置了数据源,就可以通过拖拽的方式展示一个复制过程。
在远程桌面运行命令“/u01/ogg/Oracle/GoldenGateDirector/bin/run-director.sh”可以调出图形界面:
填入任意名称,点击OK即可:
需要一点点时间生成,不要着急,然后可以拖动图标进行排列:
4.4 测试邮件告警功能
recipList为收件人的地址,多个收件人之间用逗号隔开
msgFrom为发件人的地址,填dba@lhr.com
点击发送测试邮件,几个测试邮箱均可以收到邮件:
此外,我们在web页面也可以测试邮件告警功能。登陆:http://192.168.1.36:7001/acon/
在源库新建一个表,在目标库没有这个表,那么replicat进程会报错,查看告警邮件:
通过web界面查看OGG状态:
发现R_XG这个进程的确挂掉了。
怎么样,是不是很爽,是不是非常方便呢,文末记得点赞哈。
- 点赞
- 收藏
- 关注作者
评论(0)