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

來源:互聯網
上載者:User

標籤:database   dba   資料庫   叢集   oracle rac   

    在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 工具查詢及修改。
   [[email protected] ~]$ 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 叢集心跳及其參數misscount/disktimeout/reboottime

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.