附註:

使用 OCI CLI 自動執行完整堆疊災害復原,以取得冷待命拓樸

簡介

Oracle Cloud Infrastructure Full Stack Disaster Recovery (完整堆疊 DR) 為完整堆疊雲端應用程式的所有層 (包括基礎架構、資料庫和應用程式) 提供完全自動化且全面的災害復原協調解決方案。您可以使用完整堆疊災害復原,跨 OCI 區域或相同區域內跨可用性網域復原完整堆疊應用程式。

Oracle Cloud Infrastructure Command Line Interface (OCI CLI) 是一種輕巧的工具,可以單獨使用或搭配 Oracle Cloud Console 來完成 Oracle Cloud Infrastructure (OCI) 作業。命令行介面 (CLI) 提供與 Oracle Cloud 主控台相同的核心功能,以及額外的命令。其中一部分,例如執行指令碼的能力、擴充主控台功能。

CLI 建立在 OCI SDK for Python 上,並在 Mac、Windows 或 Linux 上執行。Python 程式碼會呼叫 Oracle Cloud Infrastructure API,以提供針對各種服務實行的功能。這些是使用 HTTPS 要求和回應的 REST API。

目標

針對冷待命災害復原拓樸,使用 OCI 命令行介面 (CLI) 自動執行完整堆疊災害復原步驟。

注意:在此範例中,我們將使用 FRANKFURT 作為「主要」區域,使用 LONDON 作為「待命」區域。

部署架構

FSDR 架構

必要條件

實行

此教學課程已經建立下列資源。

資源 主要區域 - 法蘭克福
物件儲存的儲存桶 FSDR_storage_primary_test
區間 sathish.mahadev
命名空間 frrudica1wgd
執行處理 memberId ocid1.instance.......................
sourceVnicId ocid1.vnic.oc1……………………
資源 常設區域 - 倫敦
物件儲存的儲存桶 FSDR_storage_secondary_test
區間 sathish.mahadev
命名空間 frrudica1wgd

作業 1:在主要和待命區域中建立 DR 保護群組

  1. 假設您已根據偏好的平台安裝 OCI CLI。我們已在 OCI Linux VM 上安裝 OCI CLI。設定 OCI 證明資料和設定檔以連線至法蘭克福區域。

  2. 以下是建立 DR 保護群組的語法。

    用法:

    oci disaster-recovery dr-protection-group create [OPTIONS]
    

    必要的參數:

    --compartment-id, -c [text]
    --display-name [text]
    --log-location [complex type]
    

    這是必須為有效 JSON 的複雜類型。

  3. 使用下列內容建立 JSON 檔案,並將其命名為 log-location.json。將檔案儲存在偏好的位置,我們已將檔案儲存在 OCI Linux VM 的目前工作目錄中。

    {
      "bucket": "FSDR_storage_primary_test",
      "namespace": "frrudica1wgd"
    }
    
  4. 使用下列命令在 Frankfurt 區域中建立 DR 保護群組。

    oci disaster-recovery dr-protection-group create --compartment-id ocid1.compartment.oc1............ --display-name CLI_FSDR_Primary_test --log-location file://log-location.json
    

    CLI_FSDR_Primary

  5. 您可以在主要區域 (Frankfurt) 中驗證 DR 保護群組詳細資訊,按一下漢堡功能表,前往移轉與災害復原災害復原災害復原保護群組。DR 保護群組的狀態應為作用中

    CLI_FSDR_Primary

  6. 設定 OCI 證明資料和設定檔以連線至倫敦區域。使用下列內容建立 JSON 檔案,並將其命名為 log-sec-location.json。將檔案儲存在偏好的位置,我們已將檔案儲存在 OCI Linux VM 的目前工作目錄中。

    {
      "bucket": "FSDR_storage_secondary_test",
      "namespace": "frrudica1wgd"
    }
    
  7. 使用下列指令在倫敦區域中建立 DR 保護群組。

    oci disaster-recovery dr-protection-group create --compartment-id ocid1.compartment.oc1............ --display-name CLI_FSDR_Secondry_test --log-location file://log-sec-location.json
    

    CLI_FSDR_Secondry

  8. 您可以在「待命」區域 (倫敦) 中驗證 DR 保護群組詳細資訊,按一下「漢堡」功能表,移至移轉與災害復原災害復原災害復原保護群組。DR 保護群組的狀態應為作用中

    CLI_FSDR_Secondry

作業 2:關聯 DR 保護群組

  1. 以下是與 DR 保護群組關聯的語法。

    用法:

    oci disaster-recovery dr-protection-group associate [OPTIONS]
    

    必要的參數:

    --dr-protection-group-id [text]
    --role [text]
    --peer-id [text]
    --peer-region [text]
    
  2. 使用下列內容建立 JSON 檔案,並將其命名為 AssociateDrProtection.json。將檔案儲存在偏好的位置,我們已將檔案儲存在 OCI Linux VM 的目前工作目錄中。

    {
      "peerRegion": "uk-london-1",
      "peerId": "ocid1.drprotectiongroup.oc1.uk................................",
      "role": "PRIMARY"
    }
    
  3. 使用下列命令建立兩個區域之間的關聯。

    oci disaster-recovery dr-protection-group associate --dr-protection-group-id ocid1.drprotectiongroup.oc1............ --from-json file://AssociateDrProtection.json
    

    AssociateDrProtection

    • 主要區域:

      您可以驗證主要區域 (Frankfurt) 中兩個區域之間的關聯,按一下漢堡功能表,前往移轉與災害復原災害復原保護群組。DR 保護群組的狀態應為作用中

      AssociateDrProtection

    • 待命區域:

      您可以驗證待命區域 (Frankfurt) 中兩個區域之間的關聯,按一下漢堡功能表,前往移轉與災害復原災害復原保護群組。DR 保護群組的狀態應為作用中

      AssociateDrProtection

工作 3:新增成員至 DR 保護群組

先決條件

  1. 以下是新增成員至 DR 保護群組的語法。

    用法:

    oci disaster-recovery dr-protection-group update [OPTIONS]
    

    必要的參數:

    --dr-protection-group-id [text]
    --members
    
  2. 使用下列內容建立 JSON 檔案,並將其命名為 instance_members.json。將檔案儲存在偏好的位置中,我們已將檔案儲存在 OCI Linux VM.If 的目前工作目錄中,您可以在移動執行處理時,新增必要的特性。

    將成員 (運算和磁碟區群組) 新增至 DR 保護群組的 JSON 檔案。

    {
      "displayName": "CLI_FSDR_Primary",
            "members": [
          {
            "memberId": "ocid1.instance.oc1....................................",
            "memberType": "COMPUTE_INSTANCE",
            "isMovable": true,
            "vnicMapping": [
              {
                "sourceVnicId": "ocid1.vnic.oc1................................",
                "destinationSubnetId": "ocid1.subnet.oc1........................"
    
            }
          ],
          "destinationCompartmentId": "ocid1.compartment.oc1...................."
            },
    
        {
          "memberId": "ocid1.volumegroup.oc1...................................",
          "memberType": "VOLUME_GROUP"
            }],
    
            "logLocation": {
            "bucket": "FSDR_storage_primary",
            "namespace": "frrudixxxxx"
            }
    }
    
  3. 使用下列命令將成員新增至 DRPG。

    oci disaster-recovery dr-protection-group update --dr-protection-group-id ocid1.drprotectiongroup.oc1..................................... --from-json file://instance_members.json --force --debug
    

    AddMembers

  4. 您可以驗證主要區域 (Frankfurt) 中更新的 DRPG 工作要求狀態,按一下漢堡功能表,前往移轉與災害復原災害復原保護群組、選取 CLI_FSDR_Primary_test ,然後按一下工作要求

    AddMembers

  5. 您可以順利在主要區域 (Frankfurt) DRPG 新增運算和磁碟區群組資源,按一下漢堡功能表,前往移轉與災害復原災害復原保護群組,選取 CLI_FSDR_Primary_test ,然後按一下成員

    AddMembers

作業 4:在待命區域中建立切換計畫

  1. 以下是建立切換計畫的語法。

    用法:

    oci disaster-recovery dr-plan create [OPTIONS]
    

    必要的參數:

    --dr-protection-group-id [text]
    --display-name [text]
    --type [text]
    
  2. 使用下列內容建立 JSON 檔案,並將其命名為 CreateDrPlan.json。將檔案儲存在偏好的位置,我們已將檔案儲存在 OCI Linux VM 的目前工作目錄中。

    {
      "drProtectionGroupId": "ocid1.drprotectiongroup...........................",
      "displayName": "My_OCI_DR_Plan",
      "type": "SWITCHOVER"
    }
    
  3. 使用下列指令建立切換計劃。

    oci disaster-recovery dr-plan create --dr-protection-group-id ocid1.drprotectiongroup.oc1..................................... --from-json file://CreateDrPlan.json
    

    CreateDrPlan

  4. 您可以驗證待命區域 (倫敦) 中的 DR 計畫,按一下漢堡功能表,前往移轉與災害復原CLI_storage_secondary_test計畫

    CreateDrPlan

作業 5:使用使用者定義的計畫群組來自訂切換計畫

  1. 「完整堆疊災害復原」允許建立使用者定義的計畫群組,以自訂由 drPlanId (在「任務 4」中建立) 所識別之災害復原計畫的災害復原 plans.Get 明細。

    oci disaster-recovery dr-plan get --dr-plan-id ocid1.drplan.oc1......... > dr-plan-get.json
    

    這將會建立一個名為 dr-plan-get.json 的 JSON 檔案,並在 OCI Linux VM 的目前工作目錄中包含下列內容。

    {
      "data": {
        "compartment-id": "ocid1.compartment.oc1................................",
        "defined-tags": {
          "Oracle-Tags": {
            "CreatedBy": "oracleidentitycloudservice/sathish.mahadev@oracle.com",
            "CreatedOn": "2023-11-23T09:22:09.222Z"
          }
        },
        "display-name": "My OCI DR Plan",
        "dr-protection-group-id": "ocid1.drprotectiongroup.oc1.................",
        "freeform-tags": {},
        "id": "ocid1.drplan.oc1.eu-frankfurt-1.aaaaaaaacmfg3v..................",
        "life-cycle-details": null,
        "lifecycle-state": "ACTIVE",
        "peer-dr-protection-group-id": "ocid1.drprotectiongroup.oc1............",
        "peer-region": "uk-london-1",
        "plan-groups": [
          {
            "display-name": "Built-In Prechecks",
            "id": "sgid1.group..AwplAFAmPMSjruIpY8m2cw4v.......................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPMvn4IpY8m...................",
                "id": "sgid1.step..PO9O2GisLb05WkUKebi4Hofc0...................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1.uk-london-1...................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_LAUNCH_PRECHECK",
                "user-defined-step": null
              },
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPMSjrPIH1zlApY...............",
                "id": "sgid1.step..IwKsQfyM6w78JcvklS2JulU2GdH6l...............",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1.uk-london-1.anw...............",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_REMOVE_PRECHECK",
                "user-defined-step": null
              },
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPMm2cw4v.....................",
                "id": "sgid1.step..XASO1rLLQkrsOUPN............................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_STOP_PRECHECK",
                "user-defined-step": null
              },
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmpY8m2cw4v....................",
                "id": "sgid1.step..VcHYP3vKNNTrg0gMYuw.........................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "UNKNOWN_ENUM_VALUE",
                "user-defined-step": null
              },
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPY8m2cw4v....................",
                "id": "sgid1.step..wRdVq2t2d9It8P5TT2CvpMN7sy496o..............",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_RESTORE_SWITCHOVER_PRECHECK",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN_PRECHECK"
          },
          {
            "display-name": "Stop Compute Instances",
            "id": "sgid1.group..XEqWbSZn72MsIKfPAPh2cdBah9.....................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..XEqWbSZn72MsIKfP.....................",
                "id": "sgid1.step..GhvhuUwDXmyqaJe15ZrFc7......................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_STOP",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Switchover Volume Groups",
            "id": "sgid1.group..32adaPzUEQ7aH1uDWQ5VM1j........................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..32adaPzUEQ7aH........................",
                "id": "sgid1.step..ef9UNZtJ1rZIbAmW7aZK........................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_RESTORE_SWITCHOVER",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Launch Compute Instances",
            "id": "sgid1.group..5hcYKKlYTRiBwIDJcbt............................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..5hcYKKlYT............................",
                "id": "sgid1.step..woJnsXF5wTpY3uf6M...........................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_LAUNCH",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Reverse Volume Groups' Replication",
            "id": "sgid1.group..zPThgbBHnakEowbozz57EWGg.......................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..zPThgbBHnakEo........................",
                "id": "sgid1.step..w5n1aGHFGCCWGtkfbm9U........................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_REVERSE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Terminate Compute Instances",
            "id": "sgid1.group..dfo08HuDTUIdkpt5l..............................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..dfo08H...............................",
                "id": "sgid1.step..7SMxaezWR5lYX...............................",
                "is-enabled": false,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_TERMINATE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Remove Compute Instances from DR Protection Group",
            "id": "sgid1.group..pOeXUaXGLb1uhTQRwSJEB4.........................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..pOeXUaXGLb1uhT.......................",
                "id": "sgid1.step..WilcZMUCDF42M0dhABNy........................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_REMOVE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Terminate Volume Groups",
            "id": "sgid1.group..FfcGwUBiibLFaYFfcnmHv2Q591.....................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..FfcGwUBiibLFaY.......................",
                "id": "sgid1.step..wipkZ4tXRQaIxJ0bAWzOI.......................",
                "is-enabled": false,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_TERMINATE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Remove Volume Groups from DR Protection Group",
            "id": "sgid1.group..RWQ1nwbf6JkIir5vMOgz0frx.......................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..RWQ1nwbf6JkIir.......................",
                "id": "sgid1.step..7bPFQyPkxXU4zaywzFNfp.......................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_REMOVE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          }
        ],
        "system-tags": {},
        "time-created": "2023-11-23T09:22:09.690000+00:00",
        "time-updated": "2023-11-24T06:25:43.748000+00:00",
        "type": "SWITCHOVER"
      },
      "etag": "b73b71668a7f52474c4c7df9c779d9c7aae77c27109be--gzip"
    }
    
    
  2. 在 Full Stack DR 建立具有內建群組和步驟的初始 DR 計畫之後,您可以將使用者定義的群組和步驟新增至災害復原 (DR) 計畫。您可以選擇使用命令檔或 OCI 函數作為使用者定義步驟的一部分。如需詳細資訊,請參閱 OCI Full Stack Disaster Recovery User 定義的計畫群組。使用者定義的計畫群組可以在「內建前置檢查」計畫群組之後,放置 DR 計畫中的任何位置。在本教學課程中,我們將新增使用者定義計畫群組 (CustGroup-Demo) 以新增計畫的結尾。在倫敦區域啟動運算執行處理之後,步驟將會使用簡單的 Shell 命令檔來建立資料夾和檔案。

  3. 更新在上一個步驟中建立的 dr-plan-get.json,將檔案內容結尾有步驟的使用者定義計畫群組新增至現有計畫群組,並將檔案 dr-plan-get.json 重新命名為 dr-plan-get_updated.json

    最後,新增使用者定義群組之後,JSON 檔案的外觀如下所示。

     [
         {
             "display-name": "Built-In Prechecks",
             "id": "sgid1.group..AwplAFAmPMSjrPIH1zlAIqu....................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmP....................",
                     "id": "sgid1.step..PO9O2GisLb05WkUKeb..................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_LAUNCH_PRECHECK",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPMSj.................",
                     "id": "sgid1.step..IwKsQfyM6w78JcvklS2.................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_REMOVE_PRECHECK",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPMSjrP...............",
                     "id": "sgid1.step..XASO1rLLQk2GfJjKYlOf5...............",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_STOP_PRECHECK",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPMSjrP...............",
                     "id": "sgid1.step..VcHYP3vKNNTr6Ha5CB..................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "UNKNOWN_ENUM_VALUE",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPM...................",
                     "id": "sgid1.step..wRdVq2..............................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_RESTORE_SWITCHOVER_PRECHECK",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN_PRECHECK"
         },
         {
             "display-name": "Stop Compute Instances",
             "id": "sgid1.group..XEqWbSZn72MsIKfPAPh2cdBah9F1rW.............",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..XEqWbSZn72Ms.................",
                     "id": "sgid1.step..GhvhuUwDXmyqaJe1....................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_STOP",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Switchover Volume Groups",
             "id": "sgid1.group..32adaPzUEQ7aH1uDWQ5VM......................",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..32adaPzUEQ7aH1uD.............",
                     "id": "sgid1.step..ef9UNZtJ1rZ.........................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_RESTORE_SWITCHOVER",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Launch Compute Instances",
             "id": "sgid1.group..5hcYKKlYTRiBwIDJcbt3mxvA...................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..5hcYKKlYTRi..................",
                     "id": "sgid1.step..woJnsXF5wTpY3.......................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_LAUNCH",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Reverse Volume Groups' Replication",
             "id": "sgid1.group..zPThgbBHnakEowbozz57EW4vAdM9O",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..zPThgbBH.....................",
                     "id": "sgid1.step..w5n1aGHFGCCWGtk.....................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_REVERSE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Terminate Compute Instances",
             "id": "sgid1.group..dfo08HuDTUIdkpt5loA5zB.....................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..dfo08HuDTUIdkpt5lo...........",
                     "id": "sgid1.step..7SMxaezWR5lYXQ......................",
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_TERMINATE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Remove Compute Instances from DR Protection Group",
             "id": "sgid1.group..pOeXUaXGLb1uhTQRwSJEB4Yw...................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..pOeXUaXGLb1..................",
                     "id": "sgid1.step..WilcZMUCDF42M0dhAB..................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_REMOVE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Terminate Volume Groups",
             "id": "sgid1.group..FfcGwUBiibLFaYZvHEUmQRDSd..................",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..FfcGwUBiibLFaYFfcnmH.........",
                     "id": "sgid1.step..wipkZ4tXRQaIxJ0bAWzOINqf............",
                     "is-enabled": false,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_TERMINATE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Remove Volume Groups from DR Protection Group",
             "id": "sgid1.group..RWQ1nwbf6JkIir5vMOgz0Eti...................",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..RWQ1nwbf6JkIir...............",
                     "id": "sgid1.step..7bPFQyPkxXU4zaywzFN.................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_REMOVE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "CustGroup-Demo",
             "steps": [
                 {
                     "display-name": "Create Folder and Files under /home/opc",
                     "error-mode": "CONTINUE_ON_ERROR",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "USER_DEFINED",
                     "user-defined-step": {
                         "run-as-user": "opc",
                         "run-on-instance-id": "ocid1.instance.oc1..........",
                         "run-on-instance-region": "uk-london-1",
                         "script-command": "/home/opc/scripts/testCommand.sh",
                         "step-type": "RUN_LOCAL_SCRIPT"
                     }
                 }
             ],
             "type": "USER_DEFINED"
         }
     ]
    
    
  4. 使用新更新的 dr-plan-get_updated.json 檔案來更新由 drPlanId 識別的 DR 計畫。

    oci disaster-recovery dr-plan update --dr-plan-id ocid1.drplan.oc1.eu-frankfurt-1.aaaajfq --from-json file://dr-plan-get_updated.json --debug
    
  5. 您可以在「待命」區域 (倫敦) 驗證新建立的使用者定義群組,按一下「漢堡」功能表,移至移轉與災害復原災害復原保護群組計畫執行以及 My_OCI_DR_Plan

    userDefinedPlanGroup

作業 6:執行待命區域中切換計畫的前置檢查

  1. 以下是執行切換計畫前置檢查的語法。

    用法:

    oci disaster-recovery dr-plan-execution create-switchover-precheck [OPTIONS]
    

    必要的參數:

    --plan-id [text]
    
  2. 使用下列內容建立 JSON 檔案,並將其命名為 PrecheckExecution.json。將檔案儲存在偏好的位置,我們已將檔案儲存在 OCI Linux VM 的目前工作目錄中。

    {
      "displayName": "My_OCI_DR_Plan",
      "planId": "ocid1.drplan.oc1.............................................",
      "executionOptions": {
        "planExecutionType": "SWITCHOVER_PRECHECK"
      }
    }
    
    
  3. 使用下列命令可執行待命區域 (倫敦) 的「切換計畫」前置檢查。

    oci disaster-recovery dr-plan-execution create-switchover-precheck --from-json file://PrecheckExecution.json --debug
    

    createSwitchoverPrecheck

  4. 您可以驗證待命區域 (倫敦) 上的切換前置檢查狀態,按一下漢堡功能表,前往移轉與災害復原災害復原保護群組計畫執行以及我的 OCI DR 計畫

    createSwitchoverPrecheck

作業 7:在待命區域 (倫敦) 中執行切換計畫

  1. 以下是執行「切換計劃」的語法。

    用法:

    oci disaster-recovery dr-plan-execution create-switchover [OPTIONS]
    

    必要的參數:

    --plan-id [text]
    
  2. 使用下列內容建立 JSON 檔案,並將其命名為 SwitchoverExecution.json。將檔案儲存在偏好的位置,我們已將檔案儲存在 OCI Linux VM 的目前工作目錄中。

    關聯的 JSON 檔案

    {
      "displayName": "executeDRplan",
      "planId": "ocid1.drplan.oc1.............................................",
      "executionOptions": {
        "planExecutionType": "SWITCHOVER"
      }
    }
    

    使用下列指令執行 DR 計畫。

    oci disaster-recovery dr-plan-execution create --from-json file://SwitchoverExecution.json --debug
    

    DRPlanExecution

    DRPlanExecution

  3. 您可以驗證待命區域 (倫敦) 上的計畫執行狀態,按一下漢堡功能表,前往移轉與災害復原災害復原保護群組,然後按一下計畫執行

    DRPlanExecution

  4. 您可以在「待命」區域 (倫敦) 上驗證 DR 計畫執行狀態,按一下「漢堡」功能表,移至移轉與災害復原災害復原保護群組計畫執行,然後按一下 ExecuteDRplan

    DRPlanExecution

接下來的步驟

您已經瞭解如何使用 OCI CLI 命令建立 DR 保護群組、建立關聯、新增成員、建立 DR 計畫、執行前置檢查和 DR 計畫。使用 OCI CLI 針對您的購買系統大規模執行各種 Full Stack DR 生命週期作業。

認可

其他學習資源

瀏覽 docs.oracle.com/learn 的其他實驗室,或前往 Oracle Learning YouTube 頻道存取更多免費學習內容。此外,請造訪 education.oracle.com/learning-explorer 以成為 Oracle Learning Explorer。

如需產品文件,請造訪 Oracle Help Center