

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 将 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. 在集群配置文件中将 `DeletionPolicy` 设置为 `Retain`。

   ```
   ...
      - 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. 获取 L FSx ustre 文件系统 ID。

      1. 要使用，请 AWS CLI 运行以下命令并找到名称包含原始群集名称的文件系统并记下文件系统 ID。

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

      1. 要使用 AWS 管理控制台，请登录并导航到[https://console.aws.amazon.com/fsx/](https://console.aws.amazon.com/fsx/)。在文件系统列表中，找到名称中包含原始集群名称的文件系统，并记下文件系统 ID。

   1. 更新文件系统安全组规则，以提供访问该文件系统和集群子网以及从该文件系统和集群子网进行访问的权限。您可以在 Amazon FSx 控制台中找到文件系统安全组的名称和 ID。

      向文件系统安全组中添加规则，允许针对头节点和计算节点 IP CIDR 范围或前缀的入站和出站 TCP 流量。为入站和出站 TCP 流量指定 TCP 端口 988、1021、1022 和 1023。

      有关更多信息，请参阅*版本 2 AWS Command Line Interface 用户指南 EC2 *中的 [`SharedStorage`[`FsxLustreSettings`](SharedStorage-v3.md#SharedStorage-v3-FsxLustreSettings)](SharedStorage-v3.md)//[`FileSystemId`](SharedStorage-v3.md#yaml-SharedStorage-FsxLustreSettings-FileSystemId)[和为 Amazon 创建、配置和删除安全组](https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-sg.html)。

   1. 将 `SharedStorage` 部分添加到集群配置中。

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

   1. 要向集群中添加外部共享，请运行以下命令。

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