1. 首页
  2. IT资讯

RAC的VIP切换测试

Oracle 10g开始推出VIP,能够帮助数据库或者程序能够快速地进行failover。本文主要测试RAC如何进行VIP的failover。

[@more@]

1. 原来的资源状况[root@dwdb01 suk]# crs_statHA Resource Target State ———– —— —– ora.dwdb01.ASM1.asm ONLINE ONLINE on dwdb01 ora.dwdb01.LISTENER_DWDB01.lsnr ONLINE ONLINE on dwdb01 ora.dwdb01.gsd ONLINE ONLINE on dwdb01 ora.dwdb01.ons ONLINE ONLINE on dwdb01 ora.dwdb01.vip ONLINE ONLINE on dwdb01 ora.dwdb02.ASM2.asm ONLINE ONLINE on dwdb02 ora.dwdb02.LISTENER_DWDB02.lsnr ONLINE ONLINE on dwdb02 ora.dwdb02.gsd ONLINE ONLINE on dwdb02 ora.dwdb02.ons ONLINE ONLINE on dwdb02 ora.dwdb02.vip ONLINE ONLINE on dwdb02 ora.dwdb03.ASM3.asm ONLINE ONLINE on dwdb03 ora.dwdb03.LISTENER_DWDB03.lsnr ONLINE ONLINE on dwdb03 ora.dwdb03.gsd ONLINE ONLINE on dwdb03 ora.dwdb03.ons ONLINE ONLINE on dwdb03 ora.dwdb03.vip ONLINE ONLINE on dwdb03 ora.dwdb04.ASM4.asm ONLINE ONLINE on dwdb04 ora.dwdb04.LISTENER_DWDB04.lsnr ONLINE ONLINE on dwdb04 ora.dwdb04.gsd ONLINE ONLINE on dwdb04 ora.dwdb04.ons ONLINE ONLINE on dwdb04 ora.dwdb04.vip ONLINE ONLINE on dwdb04 ora.dwrac.db ONLINE ONLINE on dwdb02 ora.dwrac.dw.cs ONLINE ONLINE on dwdb04 ora.dwrac.dw.dwrac1.srv ONLINE ONLINE on dwdb01 ora.dwrac.dw.dwrac2.srv ONLINE ONLINE on dwdb02 ora.dwrac.dw.dwrac3.srv ONLINE ONLINE on dwdb03 ora.dwrac.dw.dwrac4.srv ONLINE ONLINE on dwdb04 ora.dwrac.dwrac1.inst ONLINE ONLINE on dwdb01 ora.dwrac.dwrac2.inst ONLINE ONLINE on dwdb02 ora.dwrac.dwrac3.inst ONLINE ONLINE on dwdb03 ora.dwrac.dwrac4.inst ONLINE ONLINE on dwdb04 ———————— 7 STATE=ONLINE on dwdb01 8 STATE=ONLINE on dwdb02 7 STATE=ONLINE on dwdb03 8 STATE=ONLINE on dwdb04 可以看到,所有资源都是正常online的,且VIP分布运行在各自的节点中。2. 把其中一个节点(dwdb04)的crs关掉,模拟故障关闭实例不会导致VIP切换,VIP属于nodeapp资源,因此,需要关闭crs来模拟节点或者crs故障才能观察VIP切换。[root@dwdb04 ~]# /oracle/product/10.2.0/crs/bin/crsctl stop crsStopping resources. This could take several minutes.Successfully stopped CRS resources.Stopping CSSD.Shutting down CSS daemon.Shutdown request successfully issued.3. 观察crs_stat的变化1) 停止crs后立刻在其他节点查看crs_stat:[root@dwdb01 suk]# crs_statHA Resource Target State ———– —— —– ora.dwdb01.ASM1.asm ONLINE ONLINE on dwdb01 ora.dwdb01.LISTENER_DWDB01.lsnr ONLINE ONLINE on dwdb01 ora.dwdb01.gsd ONLINE ONLINE on dwdb01 ora.dwdb01.ons ONLINE ONLINE on dwdb01 ora.dwdb01.vip ONLINE ONLINE on dwdb01 ora.dwdb02.ASM2.asm ONLINE ONLINE on dwdb02 ora.dwdb02.LISTENER_DWDB02.lsnr ONLINE ONLINE on dwdb02 ora.dwdb02.gsd ONLINE ONLINE on dwdb02 ora.dwdb02.ons ONLINE ONLINE on dwdb02 ora.dwdb02.vip ONLINE ONLINE on dwdb02 ora.dwdb03.ASM3.asm ONLINE ONLINE on dwdb03 ora.dwdb03.LISTENER_DWDB03.lsnr ONLINE ONLINE on dwdb03 ora.dwdb03.gsd ONLINE ONLINE on dwdb03 ora.dwdb03.ons ONLINE ONLINE on dwdb03 ora.dwdb03.vip ONLINE ONLINE on dwdb03 ora.dwdb04.ASM4.asm ONLINE OFFLINE ora.dwdb04.LISTENER_DWDB04.lsnr ONLINE OFFLINE ora.dwdb04.gsd ONLINE OFFLINE ora.dwdb04.ons ONLINE OFFLINE ora.dwdb04.vip ONLINE OFFLINE ora.dwrac.db ONLINE ONLINE on dwdb02 ora.dwrac.dw.cs ONLINE OFFLINE ora.dwrac.dw.dwrac1.srv ONLINE ONLINE on dwdb01 ora.dwrac.dw.dwrac2.srv ONLINE ONLINE on dwdb02 ora.dwrac.dw.dwrac3.srv ONLINE ONLINE on dwdb03 ora.dwrac.dw.dwrac4.srv ONLINE OFFLINE ora.dwrac.dwrac1.inst ONLINE ONLINE on dwdb01 ora.dwrac.dwrac2.inst ONLINE ONLINE on dwdb02 ora.dwrac.dwrac3.inst ONLINE ONLINE on dwdb03 ora.dwrac.dwrac4.inst ONLINE OFFLINE ———————— 8 STATE=OFFLINE 7 STATE=ONLINE on dwdb01 8 STATE=ONLINE on dwdb02 7 STATE=ONLINE on dwdb03可以看到,dwdb04的VIP资源此时处于offline状态。2) 隔一会再查看crs_stat [root@dwdb01 suk]# crs_statHA Resource Target State ———– —— —– ora.dwdb01.ASM1.asm ONLINE ONLINE on dwdb01 ora.dwdb01.LISTENER_DWDB01.lsnr ONLINE ONLINE on dwdb01 ora.dwdb01.gsd ONLINE ONLINE on dwdb01 ora.dwdb01.ons ONLINE ONLINE on dwdb01 ora.dwdb01.vip ONLINE ONLINE on dwdb01 ora.dwdb02.ASM2.asm ONLINE ONLINE on dwdb02 ora.dwdb02.LISTENER_DWDB02.lsnr ONLINE ONLINE on dwdb02 ora.dwdb02.gsd ONLINE ONLINE on dwdb02 ora.dwdb02.ons ONLINE ONLINE on dwdb02 ora.dwdb02.vip ONLINE ONLINE on dwdb02 ora.dwdb03.ASM3.asm ONLINE ONLINE on dwdb03 ora.dwdb03.LISTENER_DWDB03.lsnr ONLINE ONLINE on dwdb03 ora.dwdb03.gsd ONLINE ONLINE on dwdb03 ora.dwdb03.ons ONLINE ONLINE on dwdb03 ora.dwdb03.vip ONLINE ONLINE on dwdb03 ora.dwdb04.ASM4.asm ONLINE OFFLINE ora.dwdb04.LISTENER_DWDB04.lsnr ONLINE OFFLINE ora.dwdb04.gsd ONLINE OFFLINE ora.dwdb04.ons ONLINE OFFLINE ora.dwdb04.vip ONLINE ONLINE on dwdb01 ora.dwrac.db ONLINE ONLINE on dwdb02 ora.dwrac.dw.cs ONLINE ONLINE on dwdb03 ora.dwrac.dw.dwrac1.srv ONLINE ONLINE on dwdb01 ora.dwrac.dw.dwrac2.srv ONLINE ONLINE on dwdb02 ora.dwrac.dw.dwrac3.srv ONLINE ONLINE on dwdb03 ora.dwrac.dw.dwrac4.srv ONLINE OFFLINE ora.dwrac.dwrac1.inst ONLINE ONLINE on dwdb01 ora.dwrac.dwrac2.inst ONLINE ONLINE on dwdb02 ora.dwrac.dwrac3.inst ONLINE ONLINE on dwdb03 ora.dwrac.dwrac4.inst ONLINE OFFLINE ———————— 6 STATE=OFFLINE 8 STATE=ONLINE on dwdb01 8 STATE=ONLINE on dwdb02 8 STATE=ONLINE on dwdb03可以看到,dwdb04的VIP已经切换到节点dwdb01了,说明VIP的failover已经成功发生了。4. 重启启动dwdb04的crs,模拟故障节点恢复 [root@dwdb04 ~]# /oracle/product/10.2.0/crs/bin/crsctl start crsAttempting to start CRS stack The CRS stack will be started shortly[root@dwdb04 ~]# [root@dwdb01 suk]# crs_statHA Resource Target State ———– —— —– ora.dwdb01.ASM1.asm ONLINE ONLINE on dwdb01 ora.dwdb01.LISTENER_DWDB01.lsnr ONLINE ONLINE on dwdb01 ora.dwdb01.gsd ONLINE ONLINE on dwdb01 ora.dwdb01.ons ONLINE ONLINE on dwdb01 ora.dwdb01.vip ONLINE ONLINE on dwdb01 ora.dwdb02.ASM2.asm ONLINE ONLINE on dwdb02 ora.dwdb02.LISTENER_DWDB02.lsnr ONLINE ONLINE on dwdb02 ora.dwdb02.gsd ONLINE ONLINE on dwdb02 ora.dwdb02.ons ONLINE ONLINE on dwdb02 ora.dwdb02.vip ONLINE ONLINE on dwdb02 ora.dwdb03.ASM3.asm ONLINE ONLINE on dwdb03 ora.dwdb03.LISTENER_DWDB03.lsnr ONLINE ONLINE on dwdb03 ora.dwdb03.gsd ONLINE ONLINE on dwdb03 ora.dwdb03.ons ONLINE ONLINE on dwdb03 ora.dwdb03.vip ONLINE ONLINE on dwdb03 ora.dwdb04.ASM4.asm ONLINE ONLINE on dwdb04 ora.dwdb04.LISTENER_DWDB04.lsnr ONLINE ONLINE on dwdb04 ora.dwdb04.gsd ONLINE ONLINE on dwdb04 ora.dwdb04.ons ONLINE ONLINE on dwdb04 ora.dwdb04.vip ONLINE ONLINE on dwdb04 ora.dwrac.db ONLINE ONLINE on dwdb02 ora.dwrac.dw.cs ONLINE ONLINE on dwdb03 ora.dwrac.dw.dwrac1.srv ONLINE ONLINE on dwdb01 ora.dwrac.dw.dwrac2.srv ONLINE ONLINE on dwdb02 ora.dwrac.dw.dwrac3.srv ONLINE ONLINE on dwdb03 ora.dwrac.dw.dwrac4.srv ONLINE ONLINE on dwdb04 ora.dwrac.dwrac1.inst ONLINE ONLINE on dwdb01 ora.dwrac.dwrac2.inst ONLINE ONLINE on dwdb02 ora.dwrac.dwrac3.inst ONLINE ONLINE on dwdb03 ora.dwrac.dwrac4.inst ONLINE ONLINE on dwdb04 ———————— 7 STATE=ONLINE on dwdb01 8 STATE=ONLINE on dwdb02 8 STATE=ONLINE on dwdb03 7 STATE=ONLINE on dwdb04 可以看到,当故障节点恢复了,dwdb04的VIP资源又从dwdb01切换回来了。5. 模拟看看多个节点发生故障的情况[root@dwdb02 suk]# /oracle/product/10.2.0/crs/bin/crsctl stop crsStopping resources. This could take several minutes.Successfully stopped CRS resources.Stopping CSSD.Shutting down CSS daemon.Shutdown request successfully issued.[root@dwdb03 orion]# /oracle/product/10.2.0/crs/bin/crsctl stop crsStopping resources. This could take several minutes.Successfully stopped CRS resources.Stopping CSSD.Shutting down CSS daemon.Shutdown request successfully issued.[root@dwdb04 ~]# /oracle/product/10.2.0/crs/bin/crsctl stop crsStopping resources. This could take several minutes.Successfully stopped CRS resources.Stopping CSSD.Shutting down CSS daemon.Shutdown request successfully issued.[root@dwdb01 suk]# crs_statHA Resource Target State ———– —— —– ora.dwdb01.ASM1.asm ONLINE ONLINE on dwdb01 ora.dwdb01.LISTENER_DWDB01.lsnr ONLINE ONLINE on dwdb01 ora.dwdb01.gsd ONLINE ONLINE on dwdb01 ora.dwdb01.ons ONLINE ONLINE on dwdb01 ora.dwdb01.vip ONLINE ONLINE on dwdb01 ora.dwdb02.ASM2.asm ONLINE OFFLINE ora.dwdb02.LISTENER_DWDB02.lsnr ONLINE OFFLINE ora.dwdb02.gsd ONLINE OFFLINE ora.dwdb02.ons ONLINE OFFLINE ora.dwdb02.vip ONLINE ONLINE on dwdb01 ora.dwdb03.ASM3.asm ONLINE OFFLINE ora.dwdb03.LISTENER_DWDB03.lsnr ONLINE OFFLINE ora.dwdb03.gsd ONLINE OFFLINE ora.dwdb03.ons ONLINE OFFLINE ora.dwdb03.vip ONLINE ONLINE on dwdb01 ora.dwdb04.ASM4.asm ONLINE OFFLINE ora.dwdb04.LISTENER_DWDB04.lsnr ONLINE OFFLINE ora.dwdb04.gsd ONLINE OFFLINE ora.dwdb04.ons ONLINE OFFLINE ora.dwdb04.vip ONLINE ONLINE on dwdb01 ora.dwrac.db ONLINE ONLINE on dwdb01 ora.dwrac.dw.cs ONLINE ONLINE on dwdb01 ora.dwrac.dw.dwrac1.srv ONLINE ONLINE on dwdb01 ora.dwrac.dw.dwrac2.srv ONLINE OFFLINE ora.dwrac.dw.dwrac3.srv ONLINE OFFLINE ora.dwrac.dw.dwrac4.srv ONLINE OFFLINE ora.dwrac.dwrac1.inst ONLINE ONLINE on dwdb01 ora.dwrac.dwrac2.inst ONLINE OFFLINE ora.dwrac.dwrac3.inst ONLINE OFFLINE ora.dwrac.dwrac4.inst ONLINE OFFLINE ———————— 18 STATE=OFFLINE 12 STATE=ONLINE on dwdb01可见,所有故障节点的VIP都切换到正常的节点(dwdb01)上。简单总结:1. 一个节点或者crs发生故障时,VIP资源会自动切换到其他节点上。切换时间在1分钟以内。2. 只要不是全部的节点都发生故障,VIP都可以failover到正常的节点上。VIP一般优先切换到master节点上2. 当故障节点恢复时,VIP又会自动恢复到原来的节点上

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/231499/viewspace-1044085/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:布吉卡,转转请注明出处:http://www.cxybcw.com/195669.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code