Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
1.3.3. Fencing
Fencing is the disconnection of a node from the cluster's shared storage. Fencing cuts off I/O from shared storage, thus ensuring data integrity. The cluster infrastructure performs fencing through the fence daemon,
fenced
.
當 CMAN 發現一個節點已經失效,它會與其他叢集架構的元件通訊,告知這件事情。
fenced
注意到這問題時,就會把失效的節點排除在外。其他叢集架構的元件會決定該採取哪些措施 — 亦即採取任何回復措施。舉 DLM 與 GFS 為例,當收到節點失效的通知時,DLM 與 GFS 會暫停活動,直到偵測到 fenced
已經將失效節點排除之後,才會恢復運作,開始進行復原工作。DLM 會釋出失效節點的鎖定;GFS 會回復失效節點的日誌。
fencing 程式會從設定檔來決定要採取何種 fencing 措施。設定檔中有兩個主要因素決定 fencing 的措施:排除代理程式(agent)還是排除裝置(device)。fencing 程式會呼叫叢集設定檔中所指定的代理程式。接著,代理程式會透過排除裝置將節點排除在外。當 fencing 完成後,fencing 程式會通知叢集管理員。
Red Hat Cluster Suite 提供多種 fencing 方法:
- 電源 fencing — 把無法運作的節點關機。
- 光纖交換器 fencing — 停止連接儲存裝置與失效節點的光纖連接埠。
- GNBD fencing — A fencing method that disables an inoperable node's access to a GNBD server.
- 其他 fencing 方法 — 其他停止 I/O 或關閉失效節點的方法,包括 IBM Bladecenter、PAP、DRAC/MC、HP ILO、IPMI、IBM RSA II 等等。
圖形 1.3, “Power Fencing Example” shows an example of power fencing. In the example, the fencing program in node A causes the power controller to power off node D. 圖形 1.4, “Fibre Channel Switch Fencing Example” shows an example of Fibre Channel switch fencing. In the example, the fencing program in node A causes the Fibre Channel switch to disable the port for node D, disconnecting node D from storage.

圖形 1.3. Power Fencing Example

圖形 1.4. Fibre Channel Switch Fencing Example
指定 fencing 的方法,其中包含編輯叢集設定檔,以指定 fencing 方法的名稱、fencing 代理程式、以及叢集中每個裝置的 fencing 裝置。
The way in which a fencing method is specified depends on if a node has either dual power supplies or multiple paths to storage. If a node has dual power supplies, then the fencing method for the node must specify at least two fencing devices — one fencing device for each power supply (refer to 圖形 1.5, “Fencing a Node with Dual Power Supplies”). Similarly, if a node has multiple paths to Fibre Channel storage, then the fencing method for the node must specify one fencing device for each path to Fibre Channel storage. For example, if a node has two paths to Fibre Channel storage, the fencing method should specify two fencing devices — one for each path to Fibre Channel storage (refer to 圖形 1.6, “Fencing a Node with Dual Fibre Channel Connections”).

圖形 1.5. Fencing a Node with Dual Power Supplies

圖形 1.6. Fencing a Node with Dual Fibre Channel Connections
一個節點可以設定一或多個 fencing 方法。當使用一個 fencing 方法時,它會是 fence 該節點的唯一方式。當您為一個節點使用多個 fencing 方法時,這些方法會根據叢集設定檔中的設定,按順序 cascaded(串聯)在一起。如果一個節點失效,它會使用設定檔中的第一個 fencing 方法。如果第一個方法不成功,就會使用設定檔中的第二個方法。如果所有方法都不成功,那麼系統會回去嘗試第一個方法,走過整個順序,直到節點被 fence 為止。