一次RAC VIP漂移的结果诊断及修复
背景概述 客户的10G数据库VIP出现宕,引起VIP负载到另一个节点 事件支持细节 04:29:56.378 一号机器VIP 出现 went OFFLINE unexp
背景概述
客户的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 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' pinging gateway
if [ -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)
表明修改失效
本文永久更新链接地址:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)
