共用方式為


使用混沌實驗範本,以關閉已停用自動調整的虛擬機器擴展集可用性區域

您可以使用混沌實驗在受控環境中引發失敗,以驗證應用程式是否能夠從失敗中復原。 您會在本文中,使用預先填入的實驗範本和 Azure Chaos Studio,以關閉虛擬機器擴展集執行個體的可用性區域 (已停用自動調整)。

必要條件

  • Azure 訂用帳戶。 如果您沒有 Azure 訂用帳戶,請在開始之前先建立 Azure 免費帳戶
  • 虛擬機器擴展集執行個體。
  • 自動調整設定執行個體。

在虛擬機器擴展集和自動調整設定執行個體上啟用 Chaos Studio

除非資源已先新增至 Azure Chaos Studio,否則 Chaos Studio 無法對該資源插入錯誤。 若要將資源新增至 Chaos Studio,請在資源上建立目標與功能。 虛擬機器擴展集只有一個目標類型 (Microsoft-VirtualMachineScaleSet) 和一個功能 (shutdown)。 自動調整設定只有一個目標型別 (Microsoft-AutoScaleSettings) 和一個功能 (disableAutoscale)。 其他資源可能最多有兩個目標類型。 其中一個目標類型適用於服務導向錯誤。 另一個目標類型是代理程式型錯誤。 其他資源可能有許多其他功能。

  1. 開啟 Azure 入口網站

  2. 在搜尋列中搜尋 [Chaos Studio]

  3. 選取 [目標],然後尋找自動調整設定資源。

  4. 選取自動調整設定資源,然後選取 [啟用目標]> [啟用服務導向目標]

    Screenshot that shows the Targets screen in Chaos Studio, with the autoscale setting resource selected.

  5. 選取 [檢閱 + 啟用]> [啟用]

  6. 尋找虛擬機器擴展集資源。

  7. 選取虛擬機器擴展集資源,然後選取 [啟用目標]> [啟用服務導向目標]

    Screenshot that shows the Targets screen in Chaos Studio, with the virtual machine scale set resource selected.

  8. 選取 [檢閱 + 啟用]> [啟用]

您現在已成功將自動調整設定和虛擬機器擴展集新增至 Chaos Studio。

從範本建立實驗

現在,您可以從預先填入的實驗範本建立實驗。 混沌實驗會定義您想要針對目標資源採取的動作。 動作會以循序步驟組織並執行。 混沌實驗也會定義您想要針對平行執行的分支採取的動作。

  1. 在 Chaos Studio 中,移至 [實驗]> [建立]> [從範本新增]

    Screenshot that shows the Experiments screen, with the New from template button highlighted.

  2. 選取 [可用性區域關閉]

    Screenshot that shows the experiment templates screen, with the Availability Zone down template button highlighted.

  3. 為符合資源命名指導方針的實驗新增名稱。 選取 [下一步:權限]

    Screenshot that shows the experiment basics screen, with the permissions tab button highlighted.

  4. 若要讓混亂實驗順利執行,其必須具有足夠的目標資源權限。 為您的實驗選取系統指派的受控識別或使用者指派的受控識別。 如果您想要讓 Chaos Studio 將執行的必要權限 (以自訂角色的形式) 新增至實驗的身分識別,您可以選擇啟用自訂角色指派。 選取 [下一步:實驗設計工具]

    Screenshot that shows the experiment permissions screen, with the experiment designer tab button highlighted.

  5. 在 [停用自動調整] 錯誤中,選取 [編輯]

    Screenshot that shows the experiment designer screen, with the edit button within the disable autoscale fault highlighted.

  6. 檢閱錯誤參數,然後選取 [下一步:目標資源]

    Screenshot that shows the fault parameters pane for autoscale, with the target resources button highlighted.

  7. 選取您要在實驗中使用的自動調整設定資源。 選取 [儲存]。

    Screenshot that shows the fault targets pane for autoscale, with the save button highlighted.

  8. VMSS 關機 (2.0 版) 錯誤中,選取 [編輯]

    Screenshot that shows the experiment designer screen, with the edit button within the Virtual Machine Scale Set shutdown fault highlighted.

  9. 檢閱錯誤參數,然後選取 [下一步:目標資源]

    Screenshot that shows the fault parameters pane for the virtual machine scale set, with the target resources button highlighted.

  10. 選取您要在實驗中使用的虛擬機器擴展集資源。 選取 [下一步:範圍]

    Screenshot that shows the fault targets pane for Virtual Machine Scale Set, with the save button highlighted.

  11. 選取您想要關閉的虛擬機器擴展集內的區域。 選取 [儲存]。

    Screenshot that shows the scope pane, with the save button highlighted.

  12. 選取 [檢閱 + 建立]>[建立] 來儲存實驗。

執行您的實驗

您現在可以開始執行實驗。

  1. 在 [實驗] 檢視中,選取您的實驗。 選取 [開始]> [確定]
  2. 當 [狀態] 變更為 [執行中] 時,在 [歷程記錄] 下選取最近一次執行的 [詳細資料],以查看執行中實驗的詳細資料。

下一步

既然您已執行可用性區域關閉範本實驗,即可: