Welcome 微信登录

首页 / 数据库 / MySQL / 一次RAC VIP漂移的结果诊断及修复

背景概述客户的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与缺省网管通讯不畅引起。根据Oracle管方建议,调整racgvip程序中的参数从   FAIL_WHEN_DEFAULTGW_NO_FOUND=1 修改成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 gatewayif [ -n "$DEFAULTGW" ]then_RET=1# get base IP address of the interfacetmpIP=`$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_TIMESwhile [ $x -gt 0 ]doif [ -n "$tmpIP" ]thenlogx "About to execute command: $PING -S $tmpIP $PING_TIMEOUT $DEFAULTGW"$PING -S $tmpIP $PING_TIMEOUT $DEFAULTGW > /dev/null 2>&1elselogx "About to execute command: $PING $PING_TIMEOUT $DEFAULTGW"$PING $PING_TIMEOUT $DEFAULTGW > /dev/null 2>&1fi_O2=`$NETSTAT -n -I $_IF | $AWK "{ if (/^$_IF/) {print \$(NF-4); exit}}"`if [ "$_O1" != "$_O2" ]then# RX packets numbers changed_RET=0breakfi$SLEEP 1x=`$EXPR $x - 1`doneif [ $_RET -ne 0 ]thenlogx "IsIfAlive: RX packets checked if=$_IF failed"elselogx "IsIfAlive: RX packets checked if=$_IF OK"fielselogx "IsIfAlive: Default gateway is not defined (host=$HOSTNAME)"if [ $FAIL_WHEN_DEFAULTGW_NO_FOUND -eq 1 ]then_RET=1else_RET=0fifi
 从源码我们可以看到检查缺省网关的处理逻辑1、如果检测到缺省网关存在执行网管检查逻辑2、_01收集网卡网络包量3、$PING -S $tmpIP $PING_TIMEOUT $DEFAULTGW  ping网管4、_02再次收集网卡网络包量5、如果_01网卡网络包量 与 _02网卡网络包量不相同,表明网卡与缺省网卡之间通讯正常 _RET 返回编码为06、如果_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=en5Wed Nov  6 04:17:33 CST 2013 [ 6422696 ] IsIfAlive: start for if=en5Wed 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" pinging gatewayif [ -n "$DEFAULTGW" ]
    修改后:
# Check the status of the interface thro" pinging gateway
if [ -n "$DEFAULTGW" -a $FAIL_WHEN_DEFAULTGW_NO_FOUND -eq 1 ] 
   查阅oracle11.2.0.3版本的 RACGVIP代码,同样以次修改
 以下为Oracle11G的racgvip代码
if [ -n "$DEFAULTGW" -a $FAIL_WHEN_DEFAULTGW_NOT_FOUND -eq 1 ]    then      _RET=1      # get RX packets numbers      _O1=`$IFCONFIG $_IF | $AWK "{ if (/RX packets:/) { sub("packets:", "", $2); print $2}}"`      x=$CHECK_TIMES      while [ $x -gt 0 ]      do        logx "About to execute $PING -r -I $_IF $DEFAULTGW $PING_TIMEOUT"        $PING -r -I $_IF $DEFAULTGW $PING_TIMEOUT > /dev/null 2>&1        rc=$?        if [ $rc -eq 0 ]        then          _RET=0          break        else          echo "ping to $DEFAULTGW via $_IF failed, rc = $rc (host=$HOSTNAME)"        fi         x=$(($x-1))      done
  结论及解决方案修改racgvip代码修改完成后,需要观察ora.s9lp1.vip.log里出现如下信息: IsIfAlive: Default gateway is not defined (host=$HOSTNAME)表明修改失效更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12本文永久更新链接地址