

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Membuat cluster dengan Lustre yang mendukung EFA FSx
<a name="tutorial-efa-enabled-fsx-lustre"></a>

Dalam tutorial ini, Anda akan membuat cluster yang menggunakan sistem file FSx Lustre yang diaktifkan EFA sebagai penyimpanan bersama. Menggunakan sistem file FSx Lustre dengan EFA diaktifkan dapat memberikan peningkatan kinerja hingga 8x. Untuk memverifikasi apakah sistem file berkemampuan EFA adalah yang Anda butuhkan, lihat [Bekerja dengan sistem file berkemampuan EFA](https://docs.aws.amazon.com/fsx/latest/LustreGuide/efa-file-systems.html) di Panduan Pengguna *FSx for* Lustre.

Ketika Anda menggunakan AWS ParallelCluster, Anda hanya membayar untuk AWS sumber daya yang dibuat ketika Anda membuat atau memperbarui AWS ParallelCluster gambar dan cluster. Untuk informasi selengkapnya, lihat [AWS layanan yang digunakan oleh AWS ParallelCluster](aws-services-v3.md).

## Persyaratan
<a name="tutorial-efa-enabled-fsx-lustre-requirements"></a>
+  AWS CLI [diinstal dan dikonfigurasi](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
+  ParallelCluster CLI [diinstal dan dikonfigurasi](install-v3-parallelcluster.md).
+ Sebuah [key pair Amazon EC2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) untuk login ke cluster.
+ Peran IAM dengan [izin](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) yang diperlukan untuk menjalankan CLI ParallelCluster .

## Buat Grup Keamanan
<a name="tutorial-efa-enabled-fsx-lustre-security-groups"></a>

Buat dua grup keamanan di VPC yang sama di mana cluster dan sistem file akan digunakan: satu untuk klien yang berjalan pada node cluster dan satu untuk sistem file.

```
# 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
```

Dalam sisa tutorial, kita akan mengasumsikan `sg-client` dan `sg-file-system` merupakan id grup keamanan dari klien dan sistem file, masing-masing.

Konfigurasikan grup keamanan untuk klien untuk memungkinkan semua lalu lintas keluar ke sistem file, seperti yang [dipersyaratkan oleh 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
```

Konfigurasikan grup keamanan untuk sistem file untuk memungkinkan semua inbound/outbound lalu lintas di dalam dirinya sendiri dan semua lalu lintas masuk dari klien, seperti yang [dipersyaratkan oleh 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
```

## Buat sistem file
<a name="tutorial-efa-enabled-fsx-lustre-create-filesystem"></a>

Buat sistem file dalam Availability Zone (AZ) yang sama di mana node komputasi akan berada; dan ganti `subnet-compute-nodes` dengan ID-nya dalam kode berikut. Ini diperlukan untuk memungkinkan EFA bekerja dengan sistem file Anda. Perhatikan bahwa, sebagai bagian dari pembuatan sistem file, kami mengaktifkan EFA menggunakan EfaEnable properti.

```
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
```

Perhatikan id sistem file yang dikembalikan oleh perintah sebelumnya. Di sisa tutorial, ganti `fs-id` dengan id sistem file ini.

## Buat cluster
<a name="tutorial-efa-enabled-fsx-lustre-create-cluster"></a>

1. Buat cluster dengan konfigurasi berikut yang diatur dalam file konfigurasi AWS ParallelCluster YAMAL:

   1. AMI berdasarkan OS yang didukung, seperti Ubuntu 22.04.

   1. Node komputasi harus menggunakan [tipe instans yang didukung EFA yang](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html#efa-instance-types) memiliki [Nitro v4\$1](https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html), seperti g6.16xlarge.
      + Node komputasi harus berada di AZ yang sama di mana sistem file berada.
      + Node komputasi harus memiliki [EFA/Enabled](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Efa-Enabled) disetel ke true.
      + Node komputasi harus menjalankan skrip konfigurasi `configure-efa-fsx-lustre-client.sh` sebagai tindakan [OnNodeStart](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-CustomActions-OnNodeStart)khusus. Skrip, yang disediakan dalam [dokumentasi FSx resmi](https://docs.aws.amazon.com/fsx/latest/LustreGuide/configure-efa-clients.html) dan ditawarkan di bucket publik kami untuk kenyamanan Anda, dimaksudkan untuk mengonfigurasi klien FSx Lustre pada node komputasi agar mereka dapat menggunakan EFA.

1. Buat file konfigurasi cluster`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
   ```

   Kemudian buat cluster menggunakan konfigurasi itu:

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

## Validasi FSx dengan EFA berfungsi
<a name="tutorial-efa-enabled-fsx-lustre-validate"></a>

Untuk memverifikasi bahwa lalu lintas jaringan Lustre menggunakan EFA, gunakan `lnetctl` alat Lustre yang dapat menunjukkan lalu lintas jaringan untuk antarmuka jaringan tertentu. Untuk tujuan ini, jalankan perintah berikut dalam node komputasi:

```
# 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
```

Jika fitur ini berfungsi, jumlah paket yang mengalir melalui antarmuka diperkirakan akan meningkat.