

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 中使用共用儲存 AWS ParallelCluster
<a name="shared-storage-considerations-v3"></a>

在下列各節中，您將了解如何使用 AWS ParallelCluster 和共用儲存體，包括共用儲存體考量，以及如何將受管儲存體轉換為外部儲存體。

**Topics**
+ [AWS ParallelCluster 共用儲存考量](shared-storage-working-considerations-v3.md)
+ [將 AWS ParallelCluster 受管儲存體轉換為外部儲存體](shared-storage-conversion-v3.md)

# AWS ParallelCluster 共用儲存考量
<a name="shared-storage-working-considerations-v3"></a>

在 中使用共用儲存時，請考慮下列事項 AWS ParallelCluster。
+ 使用 [AWS Backup](https://docs.aws.amazon.com/aws-backup/latest/devguide/whatisbackup.html)或其他方法來備份您的檔案系統資料，以管理所有儲存系統的備份。
+ 若要新增共用儲存，請將共用儲存區段新增至您的組態檔案，並建立或更新叢集。
+ 若要移除共用儲存，請從組態檔案移除共用儲存區段，並更新叢集。
+ 若要將現有的 AWS ParallelCluster 受管共用儲存取代為新的受管儲存，請變更 / [`SharedStorage`](SharedStorage-v3.md) 的值[`Name`](SharedStorage-v3.md#yaml-SharedStorage-Name)並更新叢集。
**警告**  
根據預設，當您使用新`Name`參數執行叢集更新時，會刪除現有的 AWS ParallelCluster 受管儲存體和資料。如果您需要變更`Name`並保留現有的受管共用儲存資料，請務必先`DeletionPolicy`將 設定為 `Retain`或備份資料，再更新叢集。
+ 如果您未備份 AWS ParallelCluster 受管儲存資料，且 `DeletionPolicy`為 `Delete`，則當您的叢集遭到刪除，或從叢集組態中移除受管儲存並更新叢集時，就會刪除您的資料。
+ 如果您未備份 AWS ParallelCluster 受管儲存資料且 `DeletionPolicy`為 `Retain`，則您的檔案系統會在刪除叢集之前分離，並可重新連接至另一個叢集做為外部檔案系統。您的資料會保留。
+ 如果從叢集組態中移除 AWS ParallelCluster 受管儲存且 `DeletionPolicy` 為 `Retain`，則可以保留叢集資料的外部檔案系統重新連接至叢集。
+ 從 3.4.0 AWS ParallelCluster 版開始，您可以透過設定 / [`SharedStorage`](SharedStorage-v3.md) / [`EfsSettings`](SharedStorage-v3.md#SharedStorage-v3-EfsSettings) [`EncryptionInTransit`](SharedStorage-v3.md#yaml-SharedStorage-EfsSettings-EncryptionInTransit)和 [`IamAuthorization`](SharedStorage-v3.md#yaml-SharedStorage-EfsSettings-IamAuthorization)設定來增強 Amazon EFS 檔案系統掛載的安全性。
+ 將外部檔案系統掛載到 /home 目錄時， 會將前端節點 /home 目錄的內容 AWS ParallelCluster 複製到外部檔案系統。它會複製 /home 目錄中的現有資料，而不會覆寫外部儲存體上的現有檔案或目錄。這包括預設使用者的叢集 SSH 金鑰，以防它尚未存在於外部檔案系統上。因此，將相同外部檔案系統掛載到其個別 /home 目錄的所有其他叢集，其叢集預設使用者的 SSH 金鑰也會相同。
+ 在將相同外部檔案系統掛載到叢集 /home 目錄的多叢集環境中，只有在第一個叢集將外部檔案系統掛載到 /home 時 AWS ParallelCluster，才會產生 SSH 金鑰，該金鑰會授予在前端節點上建立的運算節點存取權。所有其他叢集都使用相同的 SSH 金鑰。因此，擁有這些共用叢集預設使用者的 SSH 金鑰的任何人都可以存取任何叢集。所有運算節點都允許使用最初產生的金鑰進行連線。

# 將 AWS ParallelCluster 受管儲存體轉換為外部儲存體
<a name="shared-storage-conversion-v3"></a>

了解如何將 AWS ParallelCluster 受管儲存轉換為外部儲存。

這些程序是以下列範例組態檔案程式碼片段為基礎。

```
...
  - MountDir: /fsx
    Name: fsx
    StorageType: FsxLustre
    FsxLustreSettings:
      StorageCapacity: 1200
      DeletionPolicy: Delete
...
```

**將 AWS ParallelCluster 受管儲存體轉換為外部儲存體**

1. 在叢集組態檔案中`Retain`將 `DeletionPolicy`設定為 。

   ```
   ...
      - MountDir: /fsx
        Name: fsx
        StorageType: FsxLustre
        FsxLustreSettings:
          StorageCapacity: 1200
          DeletionPolicy: Retain
   ...
   ```

1. 若要設定`DeletionPolicy`變更，請執行下列命令。

   ```
   pcluster update-cluster -n cluster-name -c cluster-config.yaml
   ```

1. 從叢集組態檔案移除 `SharedStorage`區段。

   ```
   ...
   ...
   ```

1. 若要將 受`SharedStorage`管變更為外部，`SharedStorage`並將其從叢集分離，請執行下列命令。

   ```
   pcluster update-cluster -n cluster-name -c cluster-config.yaml
   ```

1. 您的共用儲存體現在位於外部，並與叢集分離。

1. 若要將外部檔案系統連接到原始叢集或其他叢集，請遵循下列步驟。

   1. 取得 FSx for Lustre 檔案系統 ID。

      1. 若要使用 AWS CLI 執行下列命令，並尋找名稱包含原始叢集名稱的檔案系統，並記下檔案系統 ID。

         ```
         aws fsx describe-file-systems
         ```

      1. 若要使用 AWS 管理主控台，請登入並導覽至 https：//[https://console.aws.amazon.com/fsx/](https://console.aws.amazon.com/fsx/)。在檔案系統清單中，尋找名稱包含原始叢集名稱的檔案系統，並記下檔案系統 ID。

   1. 更新檔案系統安全群組規則，以提供對檔案系統和叢集子網路的存取。您可以在 Amazon FSx 主控台中找到檔案系統安全群組名稱和 ID。

      將規則新增至檔案系統安全群組，以允許傳入和傳出 TCP 流量往返前端節點和運算節點 IP CIDR 範圍或字首。為傳入和傳出 TCP 流量指定 TCP 連接埠 988、1021、1022 和 1023。

      如需詳細資訊，請參閱《第 [`SharedStorage`](SharedStorage-v3.md) 2 [`FsxLustreSettings`](SharedStorage-v3.md#SharedStorage-v3-FsxLustreSettings) 版使用者指南》中的 / / [`FileSystemId`](SharedStorage-v3.md#yaml-SharedStorage-FsxLustreSettings-FileSystemId)和建立、設定和刪除 Amazon EC2 的安全群組。 [ Amazon EC2 ](https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-sg.html) *AWS Command Line Interface *

   1. 將 `SharedStorage`區段新增至叢集組態。

      ```
      ...
         - MountDir: /fsx
           Name: fsx-external
           StorageType: FsxLustre
           FsxLustreSettings:
             FileSystemId: fs-02e5b4b4abd62d51c
      ...
      ```

   1. 若要將外部共用儲存新增至叢集，請執行下列命令。

      ```
      pcluster update-cluster -n cluster-name -c cluster-config.yaml
      ```