io隔離方式—-hangcheck-timer模組

來源:互聯網
上載者:User

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-----

 

 

 

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.