

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# EFA 지원 FSx Lustre를 사용하여 클러스터 생성
<a name="tutorial-efa-enabled-fsx-lustre"></a>

이 자습서에서는 EFA 지원 FSx Lustre 파일 시스템을 공유 스토리지로 사용하는 클러스터를 생성합니다. EFA가 활성화된 FSx Lustre 파일 시스템을 사용하면 최대 8배의 성능 향상을 제공할 수 있습니다. EFA 지원 파일 시스템이 필요한지 확인하려면 *FSx for Lustre 사용 설명서*의 [EFA 지원 파일 시스템 작업을](https://docs.aws.amazon.com/fsx/latest/LustreGuide/efa-file-systems.html) 참조하세요.

를 사용하는 경우 AWS ParallelCluster 이미지 및 클러스터를 생성하거나 업데이트할 때 생성된 AWS 리소스 AWS ParallelCluster에 대해서만 비용을 지불합니다. 자세한 내용은 [AWS 에서 사용하는 서비스 AWS ParallelCluster](aws-services-v3.md) 단원을 참조하십시오.

## 요구 사항
<a name="tutorial-efa-enabled-fsx-lustre-requirements"></a>
+  AWS CLI가 [설치 및 구성되어](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) 있습니다.
+ ParallelCluster CLI가 [설치 및 구성되어](install-v3-parallelcluster.md) 있습니다.
+ 클러스터에 로그인하기 위한 [Amazon EC2 키 페어](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html)입니다.
+ ParallelCluster CLI를 실행하는 데 필요한 [권한이](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) 있는 IAM 역할입니다.

## 보안 그룹 생성
<a name="tutorial-efa-enabled-fsx-lustre-security-groups"></a>

클러스터와 파일 시스템이 배포될 동일한 VPC에 두 개의 보안 그룹을 생성합니다. 하나는 클러스터 노드에서 실행되는 클라이언트용이고 다른 하나는 파일 시스템용입니다.

```
# Create security group for the FSx client
aws ec2 create-security-group \
    --group-name Fsx-Client-SecurityGroup \
    --description "Allow traffic for the FSx Lustre client" \
    --vpc-id vpc-cluster \
    --region region

# Create security group for the FSx file system
aws ec2 create-security-group \
    --group-name Fsx-FileSystem-SecurityGroup \
    --description "Allow traffic for the FSx Lustre File System" \
    --vpc-id vpc-cluster \
    --region region
```

나머지 자습서에서는 클라이언트 `sg-client` 및 파일 시스템의 보안 그룹 ID를 각각 및 `sg-file-system`로 가정합니다.

[EFA에서 요구하는](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa-start.html#efa-start-security) 대로 파일 시스템으로의 모든 아웃바운드 트래픽을 허용하도록 클라이언트의 보안 그룹을 구성합니다.

```
# Allow all outbound traffic from the client to the file system
aws ec2 authorize-security-group-egress \
 --group-id sg-client \ 
 --protocol -1 \
 --port -1 \
 --source-group sg-file-system \
 --region region
```

[EFA에서 요구하는](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa-start.html#efa-start-security) 대로 자체 내의 모든 인바운드/아웃바운드 트래픽과 클라이언트의 모든 인바운드 트래픽을 허용하도록 파일 시스템의 보안 그룹을 구성합니다.

```
# Allow all inbound traffic within this security group
aws ec2 authorize-security-group-ingress \
    --group-id sg-file-system \
    --protocol -1 \
    --port -1 \
    --source-group sg-file-system \
    --region region

# Allow all outbound traffic within this security group
aws ec2 authorize-security-group-egress \
    --group-id sg-file-system \
    --protocol -1 \
    --port -1 \
    --source-group sg-file-system \
    --region region

# Allow all inbound traffic from the client
aws ec2 authorize-security-group-ingress \
    --group-id sg-file-system \
    --protocol -1 \
    --port -1 \
    --source-group sg-client \
    --region region

# Allow all outbound traffic to the client
aws ec2 authorize-security-group-egress \
    --group-id sg-file-system \
    --protocol -1 \
    --port -1 \
    --source-group sg-client \
    --region region
```

## 파일 시스템 생성
<a name="tutorial-efa-enabled-fsx-lustre-create-filesystem"></a>

컴퓨팅 노드가 위치할 동일한 가용 영역(AZ) 내에 파일 시스템을 생성하고 다음 코드에서를 해당 ID`subnet-compute-nodes`로 바꿉니다. 이는 파일 시스템에서 EFA 작업을 허용하는 데 필요합니다. 파일 시스템 생성의 일부로 EfaEnable 속성을 사용하여 EFA를 활성화합니다.

```
aws fsx create-file-system \
    --file-system-type LUSTRE \
    --storage-capacity 38400 \
    --storage-type SSD \
    --subnet-ids subnet-compute-nodes \
    --security-group-ids sg-file-system \
    --lustre-configuration DeploymentType=PERSISTENT_2,PerUnitStorageThroughput=125,EfaEnabled=true,MetadataConfiguration={Mode=AUTOMATIC} \
    --region region
```

이전 명령에서 반환한 파일 시스템 ID를 기록해 둡니다. 자습서의 나머지 부분에서를이 파일 시스템 ID`fs-id`로 바꿉니다.

## 클러스터 생성
<a name="tutorial-efa-enabled-fsx-lustre-create-cluster"></a>

1. YAML 구성 파일에 다음 구성이 설정된 클러스터를 AWS ParallelCluster 생성합니다.

   1. Ubuntu 22.04와 같이 지원되는 OS를 기반으로 하는 AMI입니다.

   1. 컴퓨팅 노드는 g6.16xlarge와 같이 [Nitro v4\$1](https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html)가 있는 [EFA 지원 인스턴스 유형을](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html#efa-instance-types) 사용해야 합니다.
      + 컴퓨팅 노드는 파일 시스템이 있는 동일한 AZ에 있어야 합니다.
      + 컴퓨팅 노드에는 [Efa/Enabled](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Efa-Enabled)가 true로 설정되어 있어야 합니다.
      + 컴퓨팅 노드는 구성 스크립트를 [OnNodeStart](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-CustomActions-OnNodeStart) 사용자 지정 작업`configure-efa-fsx-lustre-client.sh`으로 실행해야 합니다. [FSx 공식 설명서에](https://docs.aws.amazon.com/fsx/latest/LustreGuide/configure-efa-clients.html) 제공되고 사용자의 편의를 위해 퍼블릭 버킷에 제공되는 스크립트는 EFA를 사용할 수 있도록 컴퓨팅 노드에서 FSx Lustre 클라이언트를 구성하기 위한 것입니다.

1. 클러스터 구성 파일 생성`config.yaml`:

   ```
   Region: region
   Image:
     Os: ubuntu2204
   HeadNode:
     InstanceType: c5.xlarge
     Networking:
       SubnetId: subnet-xxxxxxxxxx
       AdditionalSecurityGroups:
           - sg-client
     Ssh:
       KeyName: my-ssh-key
   Scheduling:
     Scheduler: slurm
     SlurmQueues:
       - Name: q1
         ComputeResources:
           - Name: cr1
             Instances:
               - InstanceType: g6.16xlarge
             MinCount: 1
             MaxCount: 3
             Efa:
               Enabled: true
         Networking:
           SubnetIds:
             - subnet-xxxxxxxxxx # Subnet in the same AZ where the file system is
           AdditionalSecurityGroups:
             - sg-client
           PlacementGroup:
             Enabled: false
         CustomActions:
           OnNodeStart:
             Script: https://us-east-1-aws-parallelcluster.s3.us-east-1.amazonaws.com/scripts/fsx-lustre-efa/configure-efa-fsx-lustre-client.sh
   SharedStorage:
     - MountDir: /fsx
       Name: my-fsxlustre-efa-external
       StorageType: FsxLustre
       FsxLustreSettings:
         FileSystemId: fs-id
   ```

   그런 다음 해당 구성을 사용하여 클러스터를 생성합니다.

   ```
   pcluster create-cluster \
       --cluster-name fsx-efa-tutorial \
       --cluster-configuration config.yaml \
       --region region
   ```

## EFA로 FSx가 작동하는지 확인
<a name="tutorial-efa-enabled-fsx-lustre-validate"></a>

Lustre 네트워크 트래픽이 EFA를 사용하고 있는지 확인하려면 지정된 네트워크 인터페이스에 대한 네트워크 트래픽을 표시할 수 있는 Lustre `lnetctl` 도구를 사용합니다. 이를 위해 컴퓨팅 노드에서 다음 명령을 실행합니다.

```
# Take note of the number of packets flowing through the interface, 
# which are specified in statistics:send_count and statistics:recv_count
sudo lnetctl net show --net efa -v

# Generate traffic to the file system
echo 'Hello World' > /fsx/hello-world.txt

# Take note of the number of packets flowing through the interface, 
# which are specified in statistics:send_count and statistics:recv_count
sudo lnetctl net show --net efa -v
```

기능이 작동하는 경우 인터페이스를 통해 흐르는 패킷 수가 증가할 것으로 예상됩니다.