一次RAC VIP漂移的结果诊断及修复(一)

2015-07-16 12:09:22 · 作者: · 浏览: 4

背景概述


客户的10G数据库VIP出现宕,引起VIP负载到另一个节点


事件支持细节


04:29:56.378 一号机器VIP 出现 went OFFLINE unexpectedly,当天出现这个VIP漂移的故障后为检查VIP宕掉的原因,


对VIP资源启动DEBUG 5模式:./crsctl debug log res "orahostname1.vip:5"


04:38:36.047 一号节点VIP 出现 went OFFLINE unexpectedly。


根据ora.hostname.vip.log日志显示,出现VIP宕原因基本可以确定为公网IP与缺省网管通讯不畅引起。


FAIL_WHEN_DEFAULTGW_NO_FOUND=0


但是调整完后故障依旧


04:17:37.822: [? CRSRES][11025]32ora.hostname1.vip on hostname1 went OFFLINE unexpectedly


?为明确原因,再次收集ora.hostname1.vip.log及racgvip 信息进行分析


?


?分析结果如下:


?


在racgvip程序中,有如下代码



# Check the status of the interface thro' pinging gateway


if [ -n "$DEFAULTGW" ]


then


_RET=1


# get base IP address of the interface


tmpIP=`$LSATTR -El ${_IF} -a netaddr | $AWK '{print $2}'`


# get RX packets numbers (bug8341569,9157855->bug9743421)


_O1=`$NETSTAT -n -I $_IF | $AWK "{ if (/^$_IF/) {print \\$(NF-4); exit}}"`


x=$CHECK_TIMES


while [ $x -gt 0 ]


do


if [ -n "$tmpIP" ]


then


logx "About to execute command: $PING -S $tmpIP $PING_TIMEOUT $DEFAULTGW"


$PING -S $tmpIP $PING_TIMEOUT $DEFAULTGW > /dev/null 2>&1


else


logx "About to execute command: $PING $PING_TIMEOUT $DEFAULTGW"


$PING $PING_TIMEOUT $DEFAULTGW > /dev/null 2>&1


fi


_O2=`$NETSTAT -n -I $_IF | $AWK "{ if (/^$_IF/) {print \\$(NF-4); exit}}"`


if [ "$_O1" != "$_O2" ]


then


# RX packets numbers changed


_RET=0


break


fi


$SLEEP 1


x=`$EXPR $x - 1`


done


if [ $_RET -ne 0 ]


then


logx "IsIfAlive: RX packets checked if=$_IF failed"


else


logx "IsIfAlive: RX packets checked if=$_IF OK"


fi


else


logx "IsIfAlive: Default gateway is not defined (host=$HOSTNAME)"


if [ $FAIL_WHEN_DEFAULTGW_NO_FOUND -eq 1 ]


then


_RET=1


else


_RET=0


fi


fi
?


从源码我们可以看到检查缺省网关的处理逻辑


1、如果检测到缺省网关存在执行网管检查逻辑


2、_01收集网卡网络包量


3、$PING -S $tmpIP $PING_TIMEOUT $DEFAULTGW? ping网管


4、_02再次收集网卡网络包量


5、如果_01网卡网络包量 与 _02网卡网络包量不相同,表明网卡与缺省网卡之间通讯正常 _RET 返回编码为0


6、如果_01网卡网络包量 与 _02网卡网络包量相同,_RET 返回编码没指定,缺省返回1,同时打印日志logx "IsIfAlive: RX packets checked if=$_IF failed",即判断网卡失败。


?FAIL_WHEN_DEFAULTGW_NO_FOUND参数从1修改成0,是为了跳过网关ping检测,而从源码中我们可以看到,FAIL_WHEN_DEFAULTGW_NO_FOUND参数只有在网卡参数$DEFAULTGW为空才生效,即主机上没有配置网关并且参数FAIL_WHEN_DEFAULTGW_NO_FOUND配置为非1时返回码RET为0。


?


?由于我们的环境中DEFAULTGW能获取成功及DEFAULTGW非空,导致程序没有进入FAIL_WHEN_DEFAULTGW_NO_FOUND判断是否为1的处理流程。


?


?故障期间DEBUG错误信息如下:


?



2013-11-06 04:17:37.776: [? ? RACG][1] [18219068][1][ora.s9lp1.vip]: Wed Nov? 6 04:17:33 CST 2013 [ 6422696 ] checkIf: start for if=en5


Wed Nov? 6 04:17:33 CST 2013 [ 6422696 ] IsIfAlive: start for if=en5


Wed Nov? 6 04:17:33 CST 2013 [ 6422696 ] defaultgw:? started


?


2013-11-06 04:17:37.776: [? ? RACG][1] [18219068][1][ora.s9lp1.vip]: Wed Nov? 6 04:17:33 CST 2013 [ 6422696 ] defaultgw:? completed with 10.0.241.254? (网关获取成功,网关为10.0.241.254)


Wed Nov? 6 04:17:33 CST 2013 [ 6422696 ] About to execute command: /usr/sbin/ping -S 10.0.241.150? -c 1 -w 1 10.0.241.254


?


2013-11-06 04:17:37.777: [? ? RACG][1] [18219068][1][ora.s9lp1.vip]: Wed Nov? 6 04:17:35 CST 2013 [ 6422696 ] About to execute command: /usr/sbin/ping -S 10.0.241.150? -c 1 -w 1 10.0.241.254 (PING 网关)


Wed Nov? 6 04:17:37 CST 2013 [ 6422696 ] IsIfAlive: RX packets checked if=en5 failed(由于检查到网卡en5在2秒中内网卡流量包未方式变化,判断为en5失败)
?


?1、故障每次发生都在凌晨04左右,时间如下:


?


? ? ? ? 2013-10-28 04:29:56


? ? ? ? 2013-11-01 04:38:36


? ? ? ? 2013-11-06 04:17:37
2、从源码上分析,发生故障期间网卡en5连续1秒的网络包未变化


?


? ? 可能的原因:


? ? ping -S 10.0.241.150? -c 1 -w 1 10.0.241.254


? ? Oracle检测网管时,由于当时网络质量不好导致ping不能在1秒钟内返回结果。


? ? 引起网卡en5 ping前 ping后没有 网络包发生变化。


? 根据以上分析我们建议:


?


1、修改racgvip源码跳过网管检测


? 修改前:



# Check the status of the interface thro'