Oracle 叢集心跳及其參數misscount/disktimeout/reboottime,oracle叢集

來源:互聯網
上載者:User

Oracle 叢集心跳及其參數misscount/disktimeout/reboottime,oracle叢集

    在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。
    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 <n>    #### where <n> is the maximum private network latency in seconds
       $CRS_HOME/bin/crsctl set css reboottime <r> [-force]  #### (<r> is seconds)
       $CRS_HOME/bin/crsctl set css disktimeout <d> [-force] #### (<d> 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 <n>    #### where <n> is the maximum private network latency in seconds
       $CRS_HOME/bin/crsctl set css reboottime <r> [-force]  #### (<r> is seconds)
       $CRS_HOME/bin/crsctl set css disktimeout <d> [-force] #### (<d> 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

 


可以介紹下 ORACLE 資料庫RAC叢集腦裂brain split是為何?

Oracle RAC CSS提供2種後台服務包括群組管理(Group Managment簡稱GM)和節點監控(Node Monitor簡稱NM),其中GM管理組(group)和鎖(lock)服務。在叢集中任意時刻總有一個節點會充當GM主控節點(master node)。叢集中的其他節點串列地將GM請求發送到主控節點(master node),而master node將叢集成員變更資訊廣播給叢集中的其他節點。群組成員關係(group membership)在每次發生叢集重設(cluster reconfiguration)時發生同步。每一個節點獨立地詮釋叢集成員變化資訊。
而節點監控NM服務則負責通過skgxn(skgxn-libskgxn.a,提供節點監控的庫)與其他廠商的叢集軟體保持節點資訊的一致性。此外NM還提供對我們熟知的網路心跳(Network heartbeat)和磁碟心跳(Disk heartbeat)的維護以保證節點始終存活著。當叢集成員沒有正常Network heartbeat或Disk heartbeat時NM負責將成員踢出叢集,被踢出叢集的節點將發生節點重啟(reboot)。
NM服務通過OCR中的記錄(OCR中記錄了Interconnect的資訊)來瞭解其所需要監聽和互動的端點,將心跳資訊通過網路發送到其他叢集成員。同時它也監控來自所有其他叢集成員的網路心跳Network heartbeat,每一秒鐘都會發生這樣的網路心跳,若某個節點的網路心跳在misscount(by the way:10.2.0.1中Linux上預設misscount為60s,其他平台為30s,若使用了第三方vendor clusterware則為600s,但10.2.0.1中未引入disktimeout;10.2.0.4以後misscount為60s,disktimeout為200s;11.2以後misscount為30s:CRS-4678: Successful get misscount 30 for Cluster Synchronization Services,CRS-4678: Successful get disktimeout 200 for Cluster Synchronization Services)指定的秒數中都沒有被收到的話,該節點被認為已經”死亡”了。NM還負責當其他節點加入或離開叢集時初始化叢集的重設(Initiates cluster reconfiguration)。
在解決腦裂的情境中,NM還會監控voting disk以瞭解其他的競爭子叢集(subclusters)。關於子叢集我們有必要介紹一下,試想我們的環境中存在大量的節點,以Oracle官方構建過的128個節點的環境為我們的想象空間,當網路故障發生時存在多種的可能性,一種可能性是全域的網路失敗,即128個節點中每個節點都不能互相發生網路心跳,此時會產生多達128個的資訊”孤島”子叢集。另一種可能性是局部的網路失敗,128個節點中被分成多個部分,每個部分中包含多於一個的節點,這些部分就可以被稱作子叢集(subclusters)。當出現網路故障時子叢集內部的多個節點仍能互相通訊傳輸投票資訊(vote mesg),但子叢集或者孤島節點之間已經無法通過常規的Interconnect網路交流了,這個時候NM Reconfiguration就需要用到voting disk投票磁碟。
因為NM要使用voting disk來解決因為網路故障造成的通訊障礙,所以需要保證voti......餘下全文>>
 

相關文章

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.