Sun Cluster 3.0 系統管理手冊

第 4章 管理 Quorum

本章提供從 Sun Cluster 管理「法定裝置」的程序。

以下是本章介紹的程序列表。

本章的範例大部份是以三節點叢集為例。

請參閱 Sun Cluster 3.0 概念 文件來取得 quorum 與 quorum 裝置的概念概觀。

4.1 管理 Quorum 概觀

您可以使用 scconf(1M) 指令來執行所有的 quorum 管理程序。此外,有些程序可使用 scsetup(1M) 互動式公用程式來完成。只要可能,本章將使用 scsetup 來說明 quorum 的程序。

如果任何 quorum 相關的 scconf 指令被中斷或失敗,quorum 配置資訊在叢集配置資料庫可能會變得不一致。如果發生這種情況,請重新執行指令或執行 scconf 並使用 reset 選項來回復 quorum 配置。


註解 -

scsetup(1M) 公用程式是 scconf(1M) 指令的互動式介面。當 scsetup 執行時,它會產生 scconf 指令。這些產生的指令顯示在程序範例的尾端。


有二個指令可用來檢視 quorum 配置:scstat -q 選項與 scconf -p。本章中大部份的驗證步驟使用 scconf,不過,您可以改用 scstat -q 如果您認為它的輸出更有用的話。

表 4-1 作業指引:管理 Quorum

作業 

有關資訊,請進到 ... 

將法定裝置新增到叢集中 

- 使用 scsetup

"4.1.1 如何新增法定裝置"

從叢集中移除法定裝置 

- 使用 scsetup(以產生 scconf)

"4.1.2 如何移除 Quorum 裝置"

從叢集中移除最後的法定裝置 

- 使用 scsetup(以產生 scconf)

"4.1.3 如何從叢集移除最後一個 Quorum 裝置"

取代叢集中的法定裝置 

- 使用新增與移除程序 

"4.1.4 如何置換 Quorum 裝置"

使法定裝置進入維護狀態 

(在維護狀態下,法定裝置不會參加建立法定的「投票」)。 

- 使用 scsetup(以產生 scconf)

"4.1.5 如何使 Quorum 裝置進入維護狀態"

使叢集節點進入維護狀態 

(在維護狀態下,節點不會參加建立法定的「投票」)。 

- 使用 scsetup(以產生 scconf)

"4.1.6 如何使叢集節點進入維護狀態"

將法定配置回復為預設的狀態 

- 使用 scsetup(以產生 scconf)

"4.1.7 如何讓節點脫離維護狀態並回復 quorum"

列出法定裝置與投票計數 

- 使用 scconf

"4.1.8 如何列示 Quorum 配置"

4.1.1 如何新增法定裝置

要完成這個程序,請指定一個由節點共用之磁碟裝置的裝置 ID(DID)。請使用 scdidadm -L 指令來查看 DID 名稱的列表。請參閱 scdidadm(1M) 來取得其他資訊。

請參閱 scsetup(1M)scconf(1M) 來取得這個程序使用之指令的資訊。

  1. 在叢集上某個節點成為超級使用者(superuser)。

  2. 輸入 scsetup 公用程式。


    # scsetup
    

    出現「主功能表」。

  3. 要使用 quorum 裝置,請輸入 1 (Quorum)。

    出現「Quorum 功能表」。

  4. 要新增 quorum 裝置,請輸入 1(新增 quorum 磁碟)。

    請依指示進行,同時輸入要當作 quorum 裝置的裝置。

  5. 確認 quorum 裝置新增成功。


    # scstat -q 
    
  6. 對共用儲存裝置之節點的每一個群組重複執行 步驟 3步驟 5

4.1.1.1 範例-新增 Quorum 裝置

以下範例顯示 scsetup 在新增 quorum 裝置時產生的 scconf 指令以及驗證步驟。


# scconf -a -q globaldev=d20
# scstat -q
 
-- Quorum Summary --
 
  Quorum votes possible: 4
  Quorum votes needed:   3
  Quorum votes present:  4
 
-- Quorum Votes by Node --
 
                    Node Name           Present Possible Status
                    ---------           ------- -------- ------
  Node votes:       phys-schost-1       1        1       Online
  Node votes:       phys-schost-2       1        1       Online
 
-- Quorum Votes by Device --
 
                 Device Name         Present Possible Status  Owner
                 -----------         ------- -------- ------  -----
  Device votes:  /dev/did/rdsk/d3s2  1        1       Online  phys-schost-1
  Device votes:  /dev/did/rdsk/d4s2  1        1       Online  phys-schost-1

4.1.2 如何移除 Quorum 裝置

quorum 磁碟被移除後,它將不再參與建立 quorum 的「投票』。請注意,所有二節點的叢集都要求至少配置一個 quorum 裝置。如果它是叢集上的最後一個 quorum 裝置,scconf(1M) 從配置移除裝置將會失敗。


註解 -

如果您要移除的裝置是叢集中的最後一個 quorum 裝置,請參閱程序 "4.1.3 如何從叢集移除最後一個 Quorum 裝置"


  1. 成為叢集中某個節點的超級使用者(superuser)。

  2. 決定要移除的法定裝置。


    # scconf -pv | grep Quorum
    
  3. 執行 scsetup(1M) 公用程式。


    # scsetup
    

    出現「主功能表」。

  4. 輸入 1(Quorum)來使用 quorum 裝置。

  5. 輸入 2(移除 quorum 磁碟)來移除 quorum 裝置。

    在移除程序期間回答顯示的問題。

  6. 退出 scsetup

  7. 確認 quorum 裝置移除成功。


    # scstat -q
    

4.1.2.1 範例-移除 Quorum 裝置

這個範例顯示如何從配置二個或以上 quorum 裝置的叢集移除一個 quorum 裝置。


[Become superuser on a node and place the node to be removed in maintenance state.]
[Determine the quorum device to be removed:]
# scconf -pv | grep Quorum
[Execute the scsetup utility:]
# scsetup
[Select option 1:]
*** Main Menu ***
    Please select from one of the following options:
      1) Quorum
       ...
    Option:  1
[Select option 2:]
*** Quorum Menu ***
    Please select from one of the following options:
       ...
      2) Remove a quorum disk
       ...
    Option:  2
[Answer the questions when prompted:]
 >>> Remove a Quorum Disk <<<
    ...
    Is it okay to continue (yes/no) [yes]? <Return>
    Which quorum disk do you want to remove (d<N>)?  d4
    Is it okay to proceed with the update (yes/no) [yes]? <Return>
 
scconf -r -q globaldev=d4
 
    Command completed successfully.
    Hit ENTER to continue: 
[Quit the scsetup Quorum Menu and Main Menu:]
    ...
    Option:  q
[Verify the quorum device is removed:]
# scstat -q
 
-- Quorum Summary --
 
  Quorum votes possible:      3
  Quorum votes needed:        2
  Quorum votes present:       3
 
-- Quorum Votes by Node --
 
                    Node Name           Present Possible Status
                    ---------           ------- -------- ------
  Node votes:       phys-schost-1       1        1       Online
  Node votes:       phys-schost-2       1        1       Online
 
-- Quorum Votes by Device --
 
                 Device Name         Present Possible Status  Owner
                 -----------         ------- -------- ------  -----
  Device votes:  /dev/did/rdsk/d3s2  1        1       Online  phys-schost-1

4.1.3 如何從叢集移除最後一個 Quorum 裝置

如果您要移除的裝置不是叢集中的最後一個 quorum 裝置,請使用前一個程序。"4.1.2 如何移除 Quorum 裝置".


註解 -

所有二個節點的叢集都需要至少一個已配置的 quorum 裝置。如果它就是二節點叢集上的最後一個 quorum 裝置,叢集必須先進入安裝模式,scconf(1M) 才會容許您從配置移除裝置。只有在要從叢集移除節點時,才需要這樣做。


  1. 在叢集的某個節點成為超級使用者(superuser),並使要移除的節點進入維護狀態。

    請參閱 "4.1.6 如何使叢集節點進入維護狀態"

  2. 使叢集進入安裝模式。


    # scconf -c -q installmode
    
  3. 使用 scconf 指令移除 quorum 裝置。


    # scconf -r -q globaldev=device
    
  4. 確認 quorum 裝置移除成功。


    # scstat -q
    

4.1.3.1 範例-移除最後一個 Quorum 裝置

這個範例顯示如何移除保留在叢集配置中最後一個保留的叢集配置。


[Become superuser on any node.]
[Place the cluster in install mode:]
# scconf -c -q installmode
[Remove the quorum device:]
# scconf -r -q globaldev=d3
[Verify the quorum device has been removed:]
# scstat -q
 
-- Quorum Summary --
 
  Quorum votes possible:      2
  Quorum votes needed:        2
  Quorum votes present:       2
 
-- Quorum Votes by Node --
 
                    Node Name           Present Possible Status
                    ---------           ------- -------- ------
  Node votes:       phys-schost-1       1        1       Online
  Node votes:       phys-schost-2       1        1       Online
 
-- Quorum Votes by Device --
 
                    Device Name         Present Possible Status  Owner
                    -----------         ------- -------- ------  -----

4.1.4 如何置換 Quorum 裝置

  1. 在目前含有要更換之磁碟的儲存裝置上建立新的 quorum 裝置。

    您必須先新增新 quorum 裝置到配置中來取代舊裝置。請參閱 "4.1.1 如何新增法定裝置" 來新增新 quorum 裝置到叢集。

  2. 移除當作 quorum 裝置的失效磁碟。

    請參閱 "4.1.2 如何移除 Quorum 裝置" 來取得如何從配置移除舊 quorum 裝置的資訊。

  3. 置換失效的磁碟。

    請參閱 Sun Cluster 3.0 Hardware Guide 中與您的磁碟裝置相關的硬體程序。

4.1.5 如何使 Quorum 裝置進入維護狀態

在停止 quorum 裝置的服務時使 quorum 裝置進入維護狀態,到延展的寬限期止。這樣,在維護裝置時,法定投票 計數將設成零,同時也不會造成法定投票計數。

您必須使用 scconf(1M) 指令使 quorum 裝置進入維護狀態。scsetup 公用程式沒有能力使 quorum 裝置進入維護狀態。


註解 -

所有二個節點的叢集都需要至少一個已配置的 quorum 裝置。如果這是二個節點之叢集上的最後一個 quorum 裝置,scconf 將無法成功地使裝置進入維護狀態。


  1. 在叢集上某個節點成為超級使用者(superuser)。

  2. 使 quorum 裝置進入維護狀態。


    # scconf -c -q globaldev=device,maintstate
    
    -c

    指定S scconf 指令的變更形式。

    -q

    管理 quorum 選項。

    globaldev=device

    指定要變更之磁碟裝置的 DID 名稱,例如 d4

    maintstate

    使節點進入維護狀態。

  3. 確認 quorum 裝置現在已經進入維護狀態。

    設定成維護狀態的裝置輸出,法定裝置投票的讀數應為零。


    # scconf -p | grep -i quorum
    

4.1.5.1 範例-使 Quorum 裝置進入維護狀態

以下範例顯示如何使法定裝置進入維護狀態,以及如何確認其結果。


# scconf -c -q globaldev=d20,maintstate
# scconf -p | grep -i quorum
  Node quorum vote count:                          1
  Node quorum vote count:                          1
Quorum devices:                                    d20
Quorum device name:                                d20
  Quorum device votes:                             0
  Quorum device enabled:                           no
  Quorum device path:                              /dev/did/rdsk/d20s2
  Quorum device hosts (enabled):                   phys-schost-2 phys-schost-3
  Quorum device hosts (disabled): 

4.1.5.2 下一步

當您在 quorum 裝置完成維護程序並要重新啟動 quorum 裝置時,請參閱 "4.1.7 如何讓節點脫離維護狀態並回復 quorum" 來使 quorum 裝置的投票回復為內定值。

4.1.6 如何使叢集節點進入維護狀態

在停止節點的服務時使叢集節點進入維護狀態,到延展的寬限期止。這樣,在維護節點時便不會影響 quorum 計數。要使叢集節點進入維護狀態,必須使用 scswitch(1M)shutdown(1M) 指令來關閉節點。


註解 -

請使用 Solaris shutdown 指令來關閉單一節點。只有在關閉整個叢集時,才使用 scshutdown 指令。


當叢集節點關閉並進入維護狀態時,所有配置為和節點有埠相連的 quorum 裝置,它們的 quorum 票數都會減一。當節點離開維護模式進進入線上狀態時,節點與 quorum 裝置的票數會加一。

您必須使用 scconf(1M) 來使叢集節點進入維護狀態。scsetup 公用程式沒有能力使 quorum 裝置進入維護狀態。

  1. 在要進入維護狀態的節點上成為超級使用者(superuser)。

  2. 在要進入維護狀態的節點,使用 scswitch 來從節點排除任何資源群組與磁碟裝置群組,接著使用 shutdown 來關閉並使其脫離叢集。


    phys-schost-1# scswitch -S -h node
    phys-schost-1# shutdown -g 0 -y
    
  3. 在另一個節點上成為超級使用者(superuser)並使 步驟 2 的節點進入維護狀態。


    phys-schost-2# scconf -c -q node=node,maintstate
    
    -c

    指定S scconf 指令的變更形式。

    -q

    管理 quorum 選項。

    node=node

    指定要變更之節點的節點名稱或節點 ID。

    maintstate

    使節點進入維護狀態。

  4. 確認叢集節點現在已經進入維護狀態。


    phys-schost-2# scconf -p | grep -i vote
    

4.1.6.1 範例-使叢集節點進入維護狀態

下列範例使叢集節點進入維護狀態同時確認結果。


phys-schost-1# scswitch -S -h phys-schost-1
phys-schost-1# shutdown -g 0 -y
phys-schost-2# scconf -c -q node=phys-schost-1,maintstate
phys-schost-2# scconf -p | grep -i quorum
 Node quorum vote count:                           1
Quorum devices:                                    d20
Quorum device name:                                d20
  Quorum device votes:                             1
  Quorum device enabled:                           yes
  Quorum device path:                              /dev/did/rdsk/d5s2
  Quorum device hosts (disabled):                 phys-schost-1
  Quorum device hosts (enabled):                  phys-schost-2

4.1.6.2 下一步

當您完成維護程序後,請參閱 "4.1.7 如何讓節點脫離維護狀態並回復 quorum" 來將 quorum 投票回復為內定值。

4.1.7 如何讓節點脫離維護狀態並回復 quorum

在 quorum 裝置或節點進入維護狀態之後又回到線上時,請使用以下程序將 quorum 票數(vote count)回復為內定值。在叢集節點,內定 quorum 計數為一。在 quorum 服務,內定的 quorum 計數是 N-1,其中 N 票數非零且和 quorum 裝置之間有埠相連的節點數目。

當節點進入維護狀態時,節點的 quorum 票數會遞減一。所有配置為和節點之間有連接埠的 quorum 裝置,都會使它們的 quorum 票數遞減。當 quorum 票數被回復且某個節點離開維護狀態時,節點的 quorum 票數和 quorum 裝置票數會遞增一。

您應該在任何時候節點或 quorum 裝置進入維護狀態而您要使它離開維護狀態時,執行這個程序。


小心 - 小心 -

如果您未指定 globaldevnode 選項,整個叢集的 quorum 計數都會被回復。


  1. 在叢集上某個節點成為超級使用者(superuser)。

  2. 回復 quorum 計數。

    這個範例顯示回復 quorum 裝置的 quorum 計數。請參閱 "4.1.7.2 範例-回復 Quorum 票數(叢集節點與 Quorum 裝置)" 來取得使用叢集節點而不是 quorum 裝置的範例

    在叢集節點,請先從其他節點回復 quorum 計數,否則可能因為等候 quorum 而當機。


    # scconf -c -q globaldev=device,reset
    
    -c

    指定S scconf 指令的變更形式。

    -q

    管理 quorum 選項。

    globaldev=device

    指定要回復之 quorum 裝置的 DID 名稱,例如,d4

    reset

    回復 quorum 的變更旗號。

  3. 如果您因為節點進入維護狀態而要回復 quorum 計數,請重新啟動節點。

  4. 驗證 quorum 票數。


    # scconf -p | grep -i quorum
    

4.1.7.1 範例-回復 Quorum 票數(Quorum 裝置)

以下範例將 quorum 裝置的 quorum 計數回復為內定值同時驗證結果。


# scconf -c -q globaldev=d20,reset
# scconf -p | grep -i quorum
  Node quorum vote count:                          1
  Node quorum vote count:                          1
Quorum devices:                                    d20
Quorum device name:                                d20
  Quorum device votes:                             1
  Quorum device enabled:                           yes
  Quorum device path:                              /dev/did/rdsk/d20s2
  Quorum device hosts (enabled):                   phys-schost-2 phys-schost-3
  Quorum device hosts (disabled): 

4.1.7.2 範例-回復 Quorum 票數(叢集節點與 Quorum 裝置)

以下範例將叢集節點及其 quorum 裝置的 quorum 計數回復為內定值同時驗證結果。


# scconf -c -q node=phys-schost-1,reset
# scconf -pv | grep -i vote
 Node quorum vote count:           1
 Node quorum vote count:           1
 Node quorum vote count:           1
 (d20) Quorum device votes:                        1
 (d21) Quorum device votes:                        1

4.1.8 如何列示 Quorum 配置

您不必是超級使用者(superuser)便可以列示 quorum 配置。

    使用 scconf(1M) 來列示 quorum 配置。


    # scconf -p | grep -i quorum
    

4.1.8.1 範例-列示 Quorum 配置


# scconf -p | egrep "Quorum | vote"
 Node quorum vote count:                           1
 Node quorum vote count:                           1
Quorum devices:                                    d20
Quorum device name:                                d20
  Quorum device votes:                             1
  Quorum device enabled:                           yes
  Quorum device path:                              /dev/did/rdsk/d20s2
  Quorum device hosts (enabled):                   phys-schost-2 phys-schost-3
  Quorum device hosts (disabled):