【RAC】Oracle叢集心跳及其引數misscount/disktimeout/reboottime

lhrbest發表於2017-05-20

Oracle 叢集心跳及其引數misscount/disktimeout/reboottime





  在Oracle RAC中,可以從多個層次,多個不同的機制來檢測RAC的健康狀況,即可以通過心跳機制以及一定的投票演算法來隔離故障。如果檢測到某節點失敗,則存在故障的節點將會被逐出叢集以避免故障節點破壞資料。本文主要描述了Oracle RAC下的幾種心跳機制以及心跳引數的調整。

 

一、OCSSD與CSS
    OCSSD是一個管理及提供Cluster Synchronization Services (CSS)服務的Linux或者Unix程式。使用Oracle使用者來執行該程式並提供節點成員管理功能,一旦該程式失敗,將導致節點重啟。CSS服務提供2種心跳機制,一種為網路心跳,一種為磁碟心跳。兩種心跳都有最大延時,網路心跳的延時叫MC(Misscount), 磁碟心跳延時叫作IOT (I/O Timeout)。 這2個引數都以秒為單位,預設時情況下Misscount < Disktimeout。下面分別描述這2種心跳機制。

 

二、網路心跳
    故名思義即是通過私有網路來檢測節點的狀態。如果私有網路硬體、軟體導致叢集節點間私有網路在一定時間內無法進行正常通訊,由此而導致腦裂。由於叢集環境中的儲存為共享儲存,因此此時必須要將故障節點從 叢集隔離出來,以避免資料災難。關於這個網路心跳的具體動作描述如下:
    Every one second, a sending thread in the cssd sends a network tcp heartbeat to itself and all nodes. The receiving thread of the ocssd.bin receives the heartbeat. 
    If the package network is dropped or has error, the error correction mechanism on tcp would retransmit the package.  
    Oracle does not retransmit.  From the ocssd.log, you will see a WARNING message about missing of heartbeat if a node does not receive a heartbeat from another node for 15 seconds (50% of miscount).  Another warning is reported in ocssd.log if the same node is missing for 22 seconds (75% of miscount)..another warning continues from the same node for 27 seconds (90% miscount).  When the heartbeat is missing 100% ..30 seconds miscount, the node is evicted
 
   這個網路心跳的延遲稱之為misscount,可以通過crsctl 工具查詢及修改。
   [grid@Linux-01 ~]$ crsctl get css misscount
   CRS-4678: Successful get misscount 30 for Cluster Synchronization Services.
 
   上面的查詢結果表明,如果叢集各節點間內聯網路延遲大於30s,Oracle認為節點間發生了腦裂,需要將故障節點逐出叢集。
   如何尋找故障節點,Oracle則通過投票演算法來決定,下面是一個演算法描述示例,描述參考大話Oracle RAC。
   叢集中各個節點需要心跳機制來通報彼此的"健康狀態",假設每收到一個節點的"通報"代表一票。對於三個節點的叢集,正常執行時,每個節點都會有3票。當結點A心跳出現故障但節點A還在執行,這時整個叢集就會分裂成2個小的partition。 節點A是一個,剩下的2個是一個。 這是必須剔除一個partition才能保障叢集的健康執行。 對於這3個節點的叢集, A 心跳出現問題後, B 和 C 是一個partion,有2票, A只有1票。 按照投票演算法, B 和C 組成的叢集獲得控制權, A 被剔除。如果只有2個節點,投票演算法就失效了。 因為每個節點上都只有1票。 這時就需要引入第三個裝置:Quorum Device. Quorum Device 通常採用的是共享磁碟,這個磁碟也叫作Quorum disk。 這個Quorum Disk 也代表一票。 當2個結點的心跳出現問題時, 2個節點同時去爭取Quorum Disk 這一票, 最早到達的請求被最先滿足。故最先獲得Quorum Disk的節點就獲得2票。另一個節點就會被剔除。
 
   節點一旦被隔離之後,在11gR2之前通常是重啟故障節點。而在11gR2中,ClusterWare會首先嚐試關閉該節點的所有資源,嘗試對叢集中失敗的組建進行清理,即重啟失敗的元件。如果清理失敗的元件未成功,為了強制清理,則再對節點進行重啟。

 

三、磁碟心跳
   A thread in ocssd.bin updates the voting disk every second.
   If  a node does not update the voting disks for 200 seconds, it's evicted. 
   However, the ocssd.bin on the local node has the logic that it will bring down the node if it has an I/O error more than majority of the voting disks. Also there is a CRS reconfiguration is happening when misscount is 27 second and the local node is rebooted. As a result, you rarely see an eviction due to failure of the voting disk on 10.2.0.4 (this is more common in 10.2.0.1)) because the ocssd.bin will abort the node before it get evicted by another node if writing to the voting disk is the problem.
   如上所述,每個節點會每一秒鐘更新一次表決磁碟。共享的表決磁碟用於檢查磁碟心跳。如果ocssd程式更新表決磁碟的時間超過200s,即disktimeout設定的值,Oracle會認為該表決磁碟離線,同時在Clusterware的告警日誌中生成表決磁碟離線記錄。如果當前節點表決磁碟離線的個數小於線上表決磁碟的個數,該節點能夠倖存,如果離線表決磁碟的個數大於或等於線上表決磁碟的個數,則clusterware認為磁碟心跳出現問題,故障節點會被逐出叢集,執行自動修復過程。比如有3個表決磁碟,節點A有表決磁碟出現了離線,此時離線磁碟(1個)<線上磁碟(2),clusterware會在告警日誌中生成離線記錄,但不採取任何行動。如果當前節點有2個或2個以上表決磁碟離線,此時離線磁碟(2個)>線上磁碟(1個),那節點A被踢出叢集。

 

四、RebootTime引數
    注意這個RebootTime引數,也很重要,預設情況下為3s。該參數列示的含義是節點被踢出之後,節點開始重啟允許的最大時間。通過CRSCTL工具可以看到當前reboottime的預設時間。
 [root@rhel1 bin]# ./crsctl get css reboottime   
 CRS-4678: Successful get reboottime 3 for Cluster Synchronization Services.  
從上面的執行結果可以看出,當前節點被踢出叢集之後允許開始重啟的最大時間是3秒。

    Default 3 seconds -the amount of time allowed for a node to complete a reboot 
    after the CSS daemon has been evicted.
    crsctl get css reboottime
    #Author : Leshami
    #Blog   : http://blog.csdn.net/leshami


 

五、心跳引數的調整  
 1) 10.2.0.2 to 11.1.0.7版本的修改方法
    a) Shut down CRS on all but one node. For exact steps use note 309542.1
    b) Execute crsctl as root to modify the misscount:
       $CRS_HOME/bin/crsctl set css misscount     #### where is the maximum private network latency in seconds
       $CRS_HOME/bin/crsctl set css reboottime [-force]  #### ( is seconds)
       $CRS_HOME/bin/crsctl set css disktimeout [-force] #### ( is seconds)
    c) Reboot the node where adjustment was made
    d) Start all other nodes which was shutdown in step 1
    e) Execute crsctl as root to confirm the change:
       $CRS_HOME/bin/crsctl get css misscount
       $CRS_HOME/bin/crsctl get css reboottime 
       $CRS_HOME/bin/crsctl get css disktimeout


 2) 11gR2的修改方法
     With 11gR2, these settings can be changed online without taking any node down:

    a) Execute crsctl as root to modify the misscount:
       $CRS_HOME/bin/crsctl set css misscount     #### where is the maximum private network latency in seconds
       $CRS_HOME/bin/crsctl set css reboottime [-force]  #### ( is seconds)
       $CRS_HOME/bin/crsctl set css disktimeout [-force] #### ( is seconds)
    b) Execute crsctl as root to confirm the change:
       $CRS_HOME/bin/crsctl get css misscount
       $CRS_HOME/bin/crsctl get css reboottime 
       $CRS_HOME/bin/crsctl get css disktimeout





About Me

...............................................................................................................................

● 本文整理自網路http://blog.csdn.net/leshami/article/details/39001623

● 本文在itpub(http://blog.itpub.net/26736162)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/abstract/1/

● 本文部落格園地址:http://www.cnblogs.com/lhrbest

● 本文pdf版及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/

● QQ群:230161599     微信群:私聊

● 聯絡我請加QQ好友(646634621),註明新增緣由

● 於 2017-05-09 09:00 ~ 2017-05-30 22:00 在魔都完成

● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

...............................................................................................................................

拿起手機使用微信客戶端掃描下邊的左邊圖片來關注小麥苗的微信公眾號:xiaomaimiaolhr,掃描右邊的二維碼加入小麥苗的QQ群,學習最實用的資料庫技術。

【RAC】Oracle叢集心跳及其引數misscount/disktimeout/reboottime
DBA筆試面試講解
歡迎與我聯絡

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2139636/,如需轉載,請註明出處,否則將追究法律責任。

相關文章