管理抄本檔案共用

透過移除複製關聯來管理複本檔案共用,藉此建立可獨立讀寫的共用,這些共用可分別進行更新與刪除。

您需要「管理者」或「編輯者」IAM 使用者角色,才能建立及管理檔案共用抄本及抄寫關係。 如需這些角色及動作的清單,請參閱 用於建立及管理檔案共用的 IAM 角色

抄寫同步資訊

抄寫是非同步作業,不是即時作業。 在每一個同步作業之後,系統會提供關於前次抄寫處理程序的有用資訊,例如開始及結束日期,以及傳送的資料磁區。 透過檢視抄寫資訊,您可以查看前次抄寫所花費的時間,並計算傳送速率。 查看傳送的資料值可協助您在收帳期間結束時預估廣域傳送費用。

您可以使用抄寫同步資訊來細部調整抄寫排程。 它可以協助您平衡抄本上需要重新整理資料的成本及頻率,以滿足 回復點目標在災難復原規劃中,還原資料的時間以時間 (秒、分、小時) 計算,從已復原的實體開始,到災難發生點為止。 。 它也可以協助判斷抄寫處理程序是否有退化的危險。

當要傳送的資料量超出具有正常傳送速率的抄寫視窗期間可以傳送的資料量時,抄寫處理程序無法完成,且抄寫狀態會變成 degraded。 如果發生此狀況,請嘗試調整檔案共用及抄寫頻率的變更率。

系統每15分鐘查詢一次最近的同步狀態。 結果會顯示前次已完成抄寫的資料。 如果查詢執行時正在進行抄寫,則它不會顯示在回應中。 完成抄寫之後,下一個查詢會更新前次同步資訊。 您可以預期複製完成和介面中更新最後同步資訊的時間之間會有短暫的延遲。

當您檢視來源或抄本共用的詳細資料時,可以查看前次抄寫作業的相關資訊。 如需詳細資訊,請參閱 在主控台中檢視檔案共用的詳細 資訊。

當您列出來源或抄本共用的詳細資料時,您可以查看前次抄寫作業的相關資訊。 如需相關資訊,請參閱 從 CLI 檢視檔案共用的詳細資料

您可以透過在 VPC API中呼叫 /shares 方法,以程式化方式擷取前次同步詳細資料。 在 API 回應中尋找 latest_sync 區段,以查看抄寫開始的時間 (started_at)、結束的時間 (completed_at),以及傳送的資料量 (data_transferred)。如需相關資訊,請參閱 使用 API 檢視單一檔案共用

此外,使用 IBM Cloud Logs 時,您可以檢視最近複製同步的歷史資訊。 當抄寫發生時,檔案服務會產生 regional-file.00002I 日誌訊息,其中包括抄寫發生時間及傳送資料量的相關資訊。 如需相關資訊,請參閱 VPC 記載

使用 API 驗證抄寫

您可以使用 API 來驗證抄寫成功、擱置或失敗。 您可以提出 GET /shares/{share_id} 要求,以查看具有來源或抄本共用之共用 ID 的狀態。

curl -X GET \
"$vpc_api_endpoint/v1/shares/$share_id?version=2023-08-08&generation=2"\
-H "Authorization: Bearer $iam_token"

在回應中,查看 latest_job 內容。 此範例顯示抄寫失效接手成功:

  "created_at": "2023-08-08T23:31:59Z",
  "crn": "crn:[...]",
  "encryption": "provider_managed",
  "href": "$vpc_api_endpoint/v1/shares/199d78ec-b971-4a5c-a904-8f37ae710c63",
  "id": "199d78ec-b971-4a5c-a904-8f37ae710c63",
  "iops": 3000,
  "lifecycle_state": "stable",
  "name": "share-name1",
  .
  .
  .
  "latest_job": {
      "status": "succeeded",
      "status_reason": {
          "code": "",
          "message": "",
          "more_info": ""
      },
      "type": "replication_failover"
  }

若為抄寫分割,當從來源共用分割抄本共用時,您可以在回應中看到 latest_jobrunning 狀態。

"latest_job": {
    "status": "running",
     "status_reason": {
          "code": "",
          "message": "",
         "more_info": ""
    },
    "type": "replication_split"
},

如果正在檔案共用上執行任何其他作業 (例如擴充大小),則無法進行抄寫 failoversplit 作業。 您可以在回應中看到指示問題的 409 錯誤。 請參閱下列範例。

"errors": [
    {
        "code": "share_operation_pending",
          "message": "An operation 'replication_failover' is pending on file share, request to 'replication_split' cannot be accepted.",
          "more_info": "Before sending another request wait for the current operation to complete and try again."
     }
],
"trace": "4634eee2-0a9b-43b7-b35e-8885cc258500"

移除抄寫關係

您可以透過移除來源檔案共用與抄本檔案共用之間的抄寫關係來結束抄寫。 此作業稱為 分割 檔案共用。 移除抄寫關係會建立兩個獨立的讀寫檔案共用。 它們之間不再同步資料。 您可以個別管理每一個檔案共用、擴充容量並調整 IOPS,以及建立更多抄本。

您也可以指定在 failover 作業不成功時分割來源及抄本檔案共用。

在來源或抄本檔案共用上執行另一個作業 (例如,正在展開檔案共用大小) 時,無法移除抄寫關係。 拆分操作保持掛起狀態,直到其他操作完成。

當您移除抄寫關係時,無法復原動作。 此外,在移除複製關聯之前,複本上的資料並不會自動與來源檔案同步。

在主控台中移除複製關係

若要在主控台中移除複製關係,請執行下列步驟

  1. 跳至所有檔案共用的清單。 從 IBM Cloud 主控台,按一下「導航功能表 圖示 > Infrastructure VPC 圖示 > 儲存 > 檔案儲存共用

  2. 按一下檔案共用或抄本檔案共用的名稱,以移至其詳細資料頁面。

  3. 檔案共用抄寫關係 區段中,按一下 移除抄寫關係。 移除抄寫關係會建立兩個獨立檔案共用。

  4. 在新視窗中,按一下 解除鏈結。 在移除抄寫關係之前,抄本上的資料不會自動與來源檔案共用同步。

檔案共用詳細資料頁面指出沒有抄寫關係。

從 CLI 移除抄寫關係

在使用 CLI 之前,您必須先安裝「IBM Cloud」CLI 以及 VPC CLI 外掛程式。 如需相關資訊,請參閱 CLI 必要條件

  1. 使用 ibmcloud is shares 指令列出地區中的檔案共用,以從 CLI 尋找您的共用。

    ibmcloud is shares
    
    Listing shares in all resource groups and region us-south under account Test Account as user test.user@ibm.com...
    ID                                          Name                    Lifecycle state   Zone         Profile   Size(GB)   Resource group  Replication role   Accessor binding role   Snapshot count   Snapshot size
    r006-2a10af45-de9e-4894-8e9e-fd01a25ec529   my-replica-file-share   stable            us-south-1   dp2       101        Default         replica            none                    0                0
    r006-74634ace-43bd-4983-a22b-47b1c9662794   my-source-file-share    stable            us-south-2   dp2       101        Default         source             none                    1                1
    r006-b1707390-3825-41eb-a5bb-1161f77f8a58   my-vpc-file-share       stable            us-south-2   dp2       1000       Default         none               none                    0                0
    r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6   my-file-share           stable            us-south-2   dp2       1500       Default         none               none                    0                0
    
  2. 檢視您要使用 ibmcloud is share 指令修改之檔案共用的詳細資料。

    ibmcloud is share my-file-share
    
    Getting file share my-file-share under account Test Account as user test.user@ibm.com...
    
    ID                           r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6
    Name                         my-file-share
    CRN                          crn:v1:bluemix:public:is:us-south-2:a/a1234567::share:r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6
    Lifecycle state              stable
    Access control mode          security_group
    Accessor binding role        none
    Zone                         us-south-2
    Profile                      dp2
    Size(GB)                     1500
    IOPS                         2000
    Encryption                   provider_managed
    Mount Targets                ID                                          Name
                                 r006-dd497561-c7c9-4dfb-af0a-c84eeee78b61   my-cli-share-mount-target-1
    
    Resource group               ID                                 Name
                                 db8e8d865a83e0aae03f25a492c5b39e   Default
    
    Created                      2023-10-18T22:15:15+00:00
    Latest job                   Job status   Job status reasons
                                 succeeded    -
    
    Replication share            ID                                          Name               Resource type
                                 r006-6d1719da-f790-45cc-9f68-896fd5673a1a   my-replica-share   share
    
    Replication role             source
    Replication status           active
    Replication status reasons   Status code   Status message
                                 -             -
    
    Snapshot count               0
    Snapshot size                0
    Source snapshot              -
    Allowed Access Protocols     nfs4
    Availability Mode            zonal
    Bandwidth(Mbps)              1
    Storage Generation           1
    
  3. 執行 ibmcloud is share-replica-split 指令,並依其名稱或 ID 指定抄本檔案共用。

    ibmcloud is share-replica-split r006-6d1719da-f790-45cc-9f68-896fd5673a1a
    
    This will disassociate a replica file share r006-6d1719da-f790-45cc-9f68-896fd5673a1a from its source file share and cannot be undone. Continue [y/N] ?> y
    The request to disassociate a replica file share r006-6d1719da-f790-45cc-9f68-896fd5673a1a from its source file share was accepted, under account Test Accouont as user test.user@ibm.com...
    OK
    Replica File share r006-6d1719da-f790-45cc-9f68-896fd5673a1a is disassociated.
    
  4. 此作業的結果是兩個獨立的讀寫檔案共用。 當您列出地區中的檔案共用時,您可以在兩個檔案共用的抄寫直欄中看到 none

    ibmcloud is shares
    
    Listing shares in all resource groups and region us-south under account Test Account as user test.user@ibm.com...
    ID                                          Name                    Lifecycle state   Zone         Profile   Size(GB)   Resource group   Replication role
    r006-dc6a644d-c7da-4c91-acf0-d66b47fc8516   my-replica-file-share   stable            us-south-1   dp2       1500       Default          replica
    r006-e4acfa9b-88b0-4f90-9320-537e6fa3482a   my-source-file-share    stable            us-south-2   dp2       1500       Default          source
    r006-6d1719da-f790-45cc-9f68-896fd5673a1a   my-replica-share        stable            us-south-3   dp2       1500       Default          none
    r006-925214bc-ded5-4626-9d8e-bc4e2e579232   my-new-file-share       stable            us-south-2   dp2       500        Default          none
    r006-b1707390-3825-41eb-a5bb-1161f77f8a58   my-vpc-file-share       stable            us-south-2   dp2       1000       Default          none
    r006-b696742a-92ee-4f6a-bfd7-921d6ddf8fa6   my-file-share           stable            us-south-2   dp2       1500       Default          none
    

如需指令選項的相關資訊,請參閱 ibmcloud is share-replica-split

移除與 API 的抄寫關係

提出 DELETE /shares/{replica_id}/source 要求以移除抄寫關係。 分割檔案共用會移除抄寫關係,並建立兩個獨立檔案共用。 移除關係之後,您無法重新建立關係。 如果檔案共用的 lifecycle_stateupdating 或正在進行抄本作業,則無法分割檔案共用。

curl -X DELETE \
"$vpc_api_endpoint/v1/shares/{replica_share_id}/source?version=2023-08-08&generation=2"\
-H "Authorization: Bearer $iam_token"\

成功回應指出已接受將抄本檔案共用與其來源檔案共用解除關聯的要求。

移除與 Terraform 的抄寫關係

使用 ibm_is_share_replica_operations 資源來分割來源及抄本共用。 分割檔案共用會移除抄寫關係,並建立兩個獨立檔案共用。 移除關係之後,您無法重新建立關係。

resource "ibm_is_share_replica_operations" "test" {
  share_replica = ibm_is_share.replica.id
  split_share = true
}

如需引數及屬性的相關資訊,請參閱 ibm_is_share_replica_operations

刪除副本和來源檔案共用

基於各種原因,您可能想要刪除複製檔案共用。 其中一個可能的原因是解除來源檔案共用的刪除封鎖。 由於複製檔案共用正從源共用進行活動複製,因此在刪除來源檔案共用之前,必須先從來源分割複製檔案共用。 您可以透過以下兩種方式分割股份:

  • 執行手動分割,這會移除抄寫關係,並建立兩個獨立的讀寫檔案共用。 然後,您可以像使用或刪除一般檔案共用一樣使用或刪除複製檔案共用。

  • 刪除掛載目標後,直接刪除複製檔案共用。 split 處理程序會在背景中自動起始。 分割作業完成後,副本檔案共用會被刪除,來源共用也可以被刪除。

您可以在 主控台CLIAPITerraform 中刪除檔案共用 (原始碼或副本)。