

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

# Memecahkan masalah penerapan klaster
<a name="troubleshooting-v3-cluster-deployment"></a>

Jika klaster Anda gagal dibuat dan memutar kembali pembuatan tumpukan, Anda dapat melihat file log untuk mendiagnosis masalah. Pesan kegagalan kemungkinan terlihat seperti output berikut:

```
$ pcluster create-cluster --cluster-name mycluster --region eu-west-1 \
 --cluster-configuration cluster-config.yaml
{
  "cluster": {
    "clusterName": "mycluster",
    "cloudformationStackStatus": "CREATE_IN_PROGRESS",
    "cloudformationStackArn": "arn:aws:cloudformation:eu-west-1:xxx:stack/mycluster/1bf6e7c0-0f01-11ec-a3b9-024fcc6f3387",
    "region": "eu-west-1",
    "version": "3.15.0",
    "clusterStatus": "CREATE_IN_PROGRESS"
  }
}

$ pcluster describe-cluster --cluster-name mycluster --region eu-west-1
{
  "creationTime": "2021-09-06T11:03:47.696Z",
  ...
  "cloudFormationStackStatus": "ROLLBACK_IN_PROGRESS",
  "clusterName": "mycluster",
  "computeFleetStatus": "UNKNOWN",
  "cloudformationStackArn": "arn:aws:cloudformation:eu-west-1:xxx:stack/mycluster/1bf6e7c0-0f01-11ec-a3b9-024fcc6f3387",
  "lastUpdatedTime": "2021-09-06T11:03:47.696Z",
  "region": "eu-west-1",
  "clusterStatus": "CREATE_FAILED"
}
```

**Topics**
+ [Lihat CloudFormation acara di `CREATE_FAILED`](#troubleshooting-v3-cluster-deployment-events)
+ [Gunakan CLI untuk melihat aliran log](#troubleshooting-v3-cluster-deployment-cli-logstreams)
+ [Buat ulang cluster yang gagal dengan `rollback-on-failure`](#troubleshooting-v3-cluster-deployment-cli-fail-rollback)

## Lihat CloudFormation acara di `CREATE_FAILED`
<a name="troubleshooting-v3-cluster-deployment-events"></a>

Anda dapat menggunakan konsol atau AWS ParallelCluster CLI untuk melihat CloudFormation peristiwa pada `CREATE_FAILED` kesalahan untuk membantu menemukan akar penyebabnya.

**Topics**
+ [Lihat acara di CloudFormation konsol](#troubleshooting-v3-cluster-deployment-cloudformation)
+ [Gunakan CLI untuk melihat dan memfilter acara CloudFormation `CREATE_FAILED`](#troubleshooting-v3-cluster-deployment-cli-events)

### Lihat acara di CloudFormation konsol
<a name="troubleshooting-v3-cluster-deployment-cloudformation"></a>

Untuk melihat informasi lebih lanjut tentang apa yang menyebabkan `"CREATE_FAILED"` status, Anda dapat menggunakan CloudFormation konsol.

**Lihat pesan CloudFormation kesalahan dari konsol.**

1. Masuk ke Konsol Manajemen AWS dan navigasikan ke [https://console.aws.amazon.com/cloudformation](https://console.aws.amazon.com/cloudformation/).

1. Pilih tumpukan bernama *cluster\$1name*.

1. Pilih tab **Acara**.

1. Periksa **Status** sumber daya yang gagal dibuat dengan menggulir daftar peristiwa sumber daya berdasarkan ID **Logis**. Jika subtugas gagal dibuat, kerjakan mundur untuk menemukan peristiwa sumber daya yang gagal.

1. Sebagai contoh, jika Anda melihat pesan status berikut, Anda harus menggunakan jenis instans yang tidak akan melebihi batas vCPU Anda saat ini atau meminta lebih banyak kapasitas vCPU.

   ```
   2022-02-04 16:09:44 UTC-0800	HeadNode	CREATE_FAILED	You have requested more vCPU capacity than your current vCPU limit of 0 allows 
        for the instance bucket that the specified instance type belongs to. Please visit http://aws.amazon.com/contact-us/ec2-request to request an adjustment to this limit. 
        (Service: AmazonEC2; Status Code: 400; Error Code: VcpuLimitExceeded; Request ID: a9876543-b321-c765-d432-dcba98766789; Proxy: null).
   ```

### Gunakan CLI untuk melihat dan memfilter acara CloudFormation `CREATE_FAILED`
<a name="troubleshooting-v3-cluster-deployment-cli-events"></a>

Untuk mendiagnosis masalah pembuatan cluster, Anda dapat menggunakan [`pcluster get-cluster-stack-events`](pcluster.get-cluster-stack-events-v3.md) perintah dengan memfilter `CREATE_FAILED` status. Untuk informasi selengkapnya, lihat [Memfilter AWS CLI output](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html) di *Panduan AWS Command Line Interface Pengguna*.

```
$ pcluster get-cluster-stack-events --cluster-name mycluster --region eu-west-1 \
    --query 'events[?resourceStatus==`CREATE_FAILED`]'
  [
    {
      "eventId": "3ccdedd0-0f03-11ec-8c06-02c352fe2ef9",
      "physicalResourceId": "arn:aws:cloudformation:eu-west-1:xxx:stack/mycluster/1bf6e7c0-0f02-11ec-a3b9-024fcc6f3387",
      "resourceStatus": "CREATE_FAILED",
      "resourceStatusReason": "The following resource(s) failed to create: [HeadNode]. ",
      "stackId": "arn:aws:cloudformation:eu-west-1:xxx:stack/mycluster/1bf6e7c0-0f02-11ec-a3b9-024fcc6f3387",
      "stackName": "mycluster",
      "logicalResourceId": "mycluster",
      "resourceType": "AWS::CloudFormation::Stack",
      "timestamp": "2021-09-06T11:11:51.780Z"
    },
    {
      "eventId": "HeadNode-CREATE_FAILED-2021-09-06T11:11:50.127Z",
      "physicalResourceId": "i-04e91cc1f4ea796fe",
      "resourceStatus": "CREATE_FAILED",
      "resourceStatusReason": "Received FAILURE signal with UniqueId i-04e91cc1f4ea796fe",
      "resourceProperties": "{\"LaunchTemplate\":{\"Version\":\"1\",\"LaunchTemplateId\":\"lt-057d2b1e687f05a62\"}}",
      "stackId": "arn:aws:cloudformation:eu-west-1:xxx:stack/mycluster/1bf6e7c0-0f02-11ec-a3b9-024fcc6f3387",
      "stackName": "mycluster",
      "logicalResourceId": "HeadNode",
      "resourceType": "AWS::EC2::Instance",
      "timestamp": "2021-09-06T11:11:50.127Z"
    }
  ]
```

Pada contoh sebelumnya, kegagalan ada di setup node head.

## Gunakan CLI untuk melihat aliran log
<a name="troubleshooting-v3-cluster-deployment-cli-logstreams"></a>

Untuk men-debug masalah semacam ini, Anda dapat membuat daftar aliran log yang tersedia dari node kepala dengan [`pcluster list-cluster-log-streams`](pcluster.list-cluster-log-streams-v3.md) dengan memfilter untuk `node-type` dan kemudian menganalisis konten aliran log.

```
$ pcluster list-cluster-log-streams --cluster-name mycluster --region eu-west-1 \
--filters 'Name=node-type,Values=HeadNode'
{
  "logStreams": [
    {
      "logStreamArn": "arn:aws:logs:eu-west-1:xxx:log-group:/aws/parallelcluster/mycluster-202109061103:log-stream:ip-10-0-0-13.i-04e91cc1f4ea796fe.cfn-init",
      "logStreamName": "ip-10-0-0-13.i-04e91cc1f4ea796fe.cfn-init",
      ...
    },
    {
      "logStreamArn": "arn:aws:logs:eu-west-1:xxx:log-group:/aws/parallelcluster/mycluster-202109061103:log-stream:ip-10-0-0-13.i-04e91cc1f4ea796fe.chef-client",
      "logStreamName": "ip-10-0-0-13.i-04e91cc1f4ea796fe.chef-client",
      ...
    },
    {
      "logStreamArn": "arn:aws:logs:eu-west-1:xxx:log-group:/aws/parallelcluster/mycluster-202109061103:log-stream:ip-10-0-0-13.i-04e91cc1f4ea796fe.cloud-init",
      "logStreamName": "ip-10-0-0-13.i-04e91cc1f4ea796fe.cloud-init",
      ...
    },
    ...
  ]
}
```

Dua aliran log utama yang dapat Anda gunakan untuk menemukan kesalahan inisialisasi adalah sebagai berikut:
+  `cfn-init`adalah log untuk `cfn-init` skrip. Pertama periksa aliran log ini. Anda mungkin melihat `Command chef failed` kesalahan di log ini. Lihatlah baris segera sebelum baris ini untuk lebih spesifik yang terkait dengan pesan kesalahan. Untuk informasi lebih lanjut, lihat [cfn-init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-init.html).
+  `cloud-init`adalah log untuk [cloud-init](https://cloudinit.readthedocs.io/). Jika Anda tidak melihat apa pun`cfn-init`, coba periksa log ini selanjutnya.

Anda dapat mengambil konten aliran log dengan menggunakan [`pcluster get-cluster-log-events`](pcluster.get-cluster-log-events-v3.md) (perhatikan `--limit 5` opsi untuk membatasi jumlah peristiwa yang diambil):

```
$ pcluster get-cluster-log-events --cluster-name mycluster \
  --region eu-west-1 --log-stream-name ip-10-0-0-13.i-04e91cc1f4ea796fe.cfn-init \
  --limit 5
{
  "nextToken": "f/36370880979637159565202782352491087067973952362220945409/s",
  "prevToken": "b/36370880752972385367337528725601470541902663176996585497/s",
  "events": [
    {
      "message": "2021-09-06 11:11:39,049 [ERROR] Unhandled exception during build: Command runpostinstall failed",
      "timestamp": "2021-09-06T11:11:39.049Z"
    },
    {
      "message": "Traceback (most recent call last):\n  File \"/opt/aws/bin/cfn-init\", line 176, in <module>\n    worklog.build(metadata, configSets)\n  File \"/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py\", line 135, in build\n    Contractor(metadata).build(configSets, self)\n  File \"/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py\", line 561, in build\n    self.run_config(config, worklog)\n  File \"/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py\", line 573, in run_config\n    CloudFormationCarpenter(config, self._auth_config).build(worklog)\n  File \"/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py\", line 273, in build\n    self._config.commands)\n  File \"/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py\", line 127, in apply\n    raise ToolError(u\"Command %s failed\" % name)",
      "timestamp": "2021-09-06T11:11:39.049Z"
    },
    {
      "message": "cfnbootstrap.construction_errors.ToolError: Command runpostinstall failed",
      "timestamp": "2021-09-06T11:11:39.049Z"
    },
    {
      "message": "2021-09-06 11:11:49,212 [DEBUG] CloudFormation client initialized with endpoint https://cloudformation.eu-west-1.amazonaws.com",
      "timestamp": "2021-09-06T11:11:49.212Z"
    },
    {
      "message": "2021-09-06 11:11:49,213 [DEBUG] Signaling resource HeadNode in stack mycluster with unique ID i-04e91cc1f4ea796fe and status FAILURE",
      "timestamp": "2021-09-06T11:11:49.213Z"
    }
  ]
}
```

Pada contoh sebelumnya, kegagalan disebabkan oleh `runpostinstall` kegagalan, sehingga sangat terkait dengan konten skrip bootstrap khusus yang digunakan dalam parameter `OnNodeConfigured` konfigurasi file[`CustomActions`](HeadNode-v3.md#HeadNode-v3-CustomActions).

## Buat ulang cluster yang gagal dengan `rollback-on-failure`
<a name="troubleshooting-v3-cluster-deployment-cli-fail-rollback"></a>

AWS ParallelCluster membuat aliran CloudWatch log cluster di grup log. Anda dapat melihat log ini di CloudWatch konsol **Dasbor Kustom** atau **grup Log**. Untuk informasi selengkapnya, lihat [Integrasi dengan Amazon CloudWatch Logs](cloudwatch-logs-v3.md) dan [CloudWatch Dasbor Amazon](cloudwatch-dashboard-v3.md). Jika tidak ada aliran log yang tersedia, kegagalan mungkin disebabkan oleh skrip bootstrap [`CustomActions`](HeadNode-v3.md#HeadNode-v3-CustomActions) khusus atau masalah terkait AMI. Untuk mendiagnosis masalah pembuatan dalam kasus ini, buat cluster lagi menggunakan[`pcluster create-cluster`](pcluster.create-cluster-v3.md), termasuk `--rollback-on-failure` parameter yang disetel ke`false`. Kemudian, gunakan SSH untuk melihat cluster, seperti yang ditunjukkan pada berikut ini:

```
$ pcluster create-cluster --cluster-name mycluster --region eu-west-1 \
   --cluster-configuration cluster-config.yaml --rollback-on-failure false
 {
   "cluster": {
     "clusterName": "mycluster",
     "cloudformationStackStatus": "CREATE_IN_PROGRESS",
     "cloudformationStackArn": "arn:aws:cloudformation:eu-west-1:xxx:stack/mycluster/1bf6e7c0-0f01-11ec-a3b9-024fcc6f3387",
     "region": "eu-west-1",
     "version": "3.15.0",
     "clusterStatus": "CREATE_IN_PROGRESS"
   }
 } 
 $ pcluster ssh --cluster-name mycluster
```

Setelah Anda masuk ke node kepala, Anda harus menemukan tiga file log utama yang dapat Anda gunakan untuk menemukan kesalahan.
+  `/var/log/cfn-init.log`adalah log untuk `cfn-init` skrip. Pertama periksa log ini. Anda mungkin melihat kesalahan seperti `Command chef failed` di log ini. Lihatlah baris segera sebelum baris ini untuk lebih spesifik yang terkait dengan pesan kesalahan. Untuk informasi lebih lanjut, lihat [cfn-init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-init.html).
+  `/var/log/cloud-init.log`adalah log untuk [cloud-init](https://cloudinit.readthedocs.io/). Jika Anda tidak melihat apa pun`cfn-init.log`, coba periksa log ini selanjutnya. 
+  `/var/log/cloud-init-output.log`adalah output dari perintah yang dijalankan oleh [cloud-init](https://cloudinit.readthedocs.io/). Ini termasuk output dari`cfn-init`. Dalam kebanyakan kasus, Anda tidak perlu melihat log ini untuk memecahkan masalah jenis ini.