io隔离方式----hangcheck-timer模块

来源:互联网 发布:游戏王dl数据转移 编辑:程序博客网 时间:2024/06/10 01:10

author:skate

time:2010-05-12



此文档摘自METALINK:726833.1,所适用的ORACLE版本为:Oracle Server - Enterprise Edition - Version: 9.2.0.8 to 11.1.0.7

 

从9.2.0.2版本开始,ORACLE RAC环境需要使用一个新的I/O fencing模块,叫做hangcheck-timer模块。
这个模块用来代替Watchdog模块,提供类似的fencing功能。Hangcheck-timer模块是标准的linux2.4以
上的内核中的一个子功能被发布。

 

1. hangcheck-timer简介

 

Hangcheck-timer应该在系统启动的时候被加载, 并对于能够影响RAC节点稳定性的长时间的系统操作HANG进行内核监控。
它运行在内核级别并使用Time Stamp Counter(TSC)来捕捉调度的延迟和节点HANG。这是通过设置一个timer,然后检查这
个timer的fires情况来判断是否延迟是否超过了误差的幅度。如果这个周期超过了允许的时间(也就是hangcheck_tick+hangcheck_margin秒),机器将会被重启,如果是CPU资源不足的时候,Hangcheck-timer将不会导致重启


Hangcheck-timer有三个配置参数:


hangcheck_tick:定义了hangcheck-timer检查节点是否hang的频率,单位是秒,缺省是60秒
hangcheck_margin:定义期望的和真正的scheduling之间允许的误差,单位是秒,缺省值是180秒
hangcheck_reboot:定义了如果内核在hangcheck-tick和hangcheck-margin相加的时间内响应失败的话,hangcheck-timer是否重启节点。如果hangcheck_reboot的值大于等于1,hangcheck-timer模块将会重启系统;如果设置为0,则即使系统hang的时候hangcheck-timer也不会重启系统。在linux 2.4的内核中,这个缺省值是1;在2.6的内核中,缺省值是0。

 

当hangcheck_reboot=1并且满足下面的公式时,hangcheck-timer将reboot系统
system hang time > (hangcheck_tick + hangcheck_margin)

 

 

所有的hangcheck-timer的参数的缺省值必须在加载内核模块的时候被显式的覆盖,不同的oracle版本可以按照下面来设置:

 

9i: 假如"oracle misscount"的缺省设置是220秒,则hangcheck_tick=30 hangcheck_margin=180 hangcheck_reboot=1
10g/11g: 假如"CSS misscount"的设置是30或者60秒,则hangcheck_tick=1 hangcheck_margin=10 hangcheck_reboot=1

 

不过对于目前大多数的环境,我问了几个朋友的rac这几个参数的设置一般为
misscount=220
hangcheck_tick=30
hangcheck_margin=180

 

注意:你必须设置集群的misscount值大于hangcheck_tick + hangcheck_margin之和


2. hangcheck-timer.ko模块安装:

 

hangcheck-timer被默认安装在linux版本 2.4.9-e.12 及之上版本中,可以用如下命令核查hangcheck-timer是否安装。

 

[root@rac2 oracle]# find /lib -name "hangcheck-timer.ko"
/lib/modules/2.6.9-78.EL/kernel/drivers/char/hangcheck-timer.ko
/lib/modules/2.6.9-89.0.23.ELxenU/kernel/drivers/char/hangcheck-timer.ko
/lib/modules/2.6.9-78.ELsmp/kernel/drivers/char/hangcheck-timer.ko
有以上输出,代表已经安装了

 

modprobe命令将在模块路径/lib/modules/'uname -r'/中搜寻所有的模块和文件。

 

3. 配置hangcheck-timer
修改配置文件/etc/modprobe.conf ,我的这个文件的内容如下:

 

[root@rac2 oracle]# more /etc/modprobe.conf
alias eth0 pcnet32
alias eth1 pcnet32
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptscsi
alias scsi_hostadapter2 mptspi
alias scsi_hostadapter3 mptsas
alias scsi_hostadapter4 mptscsih
alias scsi_hostadapter5 ata_piix


options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
[root@rac2 oracle]# 

 

4. 加载hangcheck-timer模块


这个模块是在oracle需要时自动调用的,可以不需要用modprobe或insmod命令来放在启动文件加载。但是一般的条件下,
我们还是把这个命令放在系统引导文件中。

 

为了使得在系统启动的时候就自动加载,可以把上面的命令添加到/etc/rc.d/rc.local或者/etc/init.d/boot.local或者
/etc/rc.local中,这个根据不同的发行版来决定。

 

例如:
# echo "/sbin/modprobe hangcheck-timer" >> /etc/rc.local

 

说明:

在oracle linux、红帽linux4/5或者SUSE linux9/10中,hangcheck-timer模块使用modprobe命令替换insmod命令
(因为modprobe更灵巧些)来进行加载:


# modprobe hangcheck-timer hangcheck_tick=1 hangcheck_margin=10 hangcheck_reboot=1


5. 查证hangcheck-timer的参数是否正确的方法

[root@rac2 ~]# /sbin/lsmod |grep hangcheck
hangcheck_timer         7897  0

 

 

hangcheck-timer的启动信息都会记录在系统日志里“ /var/log/messages”
重启时会记录"Hangcheck: hangcheck is restarting the machine"信息到/var/log/messages

 

如果你看到/var/log/messages中有"Hangcheck: hangcheck value past margin!"消息,表示系
统需要重启但是没有重启,因为hangcheck-reboot参数没有设置为1。


[root@rac2 ~]#

[root@rac2 ~]# su -
[root@rac2 ~]# grep hangcheck /var/log/messages |tail -2
May 10 10:03:56 rac2 kernel: Hangcheck: starting hangcheck timer 0.9.0 (tick is 30 seconds, margin is 180 seconds).
[root@rac2 ~]#

 


 文档参考:
http://zhang41082.itpub.net/post/7167/467614
http://www.rampant-books.com/art_hunter_rac_oracle%20linux_hangcheck_kernel_module.htm

 

 

 

 

---end-----

 

 

 

 

 

 

 

原创粉丝点击