

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

# 使用 `pcluster update`
<a name="using-pcluster-update"></a>

從 2.8.0 AWS ParallelCluster 版開始， 會[`pcluster update`](pcluster.update.md)分析用來建立目前叢集的設定，以及組態檔案中的問題設定。如果發現任何問題，則會回報這些問題，並顯示修正問題所採取的步驟。例如，如果[`compute_instance_type`](cluster-definition.md#compute-instance-type)設定變更為不同的執行個體類型，則必須先停止運算機群，才能繼續更新。此問題會在發現時回報。如果未報告封鎖問題，系統會提示您是否要套用變更。

每個設定的文件會定義該設定的更新政策。

**更新政策：您可以在更新期間變更這些設定。****更新政策：此設定可以在更新期間變更。**  
您可以變更這些設定，也可以使用 更新叢集[`pcluster update`](pcluster.update.md)。

**更新政策：如果變更此設定，則不允許更新。**  
如果現有的叢集尚未刪除，則無法變更這些設定。必須還原變更或刪除叢集 （使用 [`pcluster delete`](pcluster.delete.md))，然後在舊叢集的位置建立新的叢集 （使用 [`pcluster create`](pluster.create.md))。

**更新政策：更新期間不會分析此設定。**  
您可以變更這些設定，並使用 更新叢集[`pcluster update`](pcluster.update.md)。

**更新政策：必須停止運算機群，才能變更此設定以進行更新。**  
當運算機群存在時，無法變更這些設定。必須還原變更，或必須停止運算機群 （使用 [`pcluster stop`](pcluster.stop.md))、更新 （使用 [`pcluster update`](pcluster.update.md))，然後建立新的運算機群 （使用 [`pcluster start`](pcluster.start.md))。

**更新政策：此設定無法在更新期間減少。**  
這些設定可以變更，但無法減少。如果必須減少這些設定，則必須刪除叢集 （使用 [`pcluster delete`](pcluster.delete.md))，並建立新的叢集 （使用 [`pcluster create`](pluster.create.md))。

**更新政策：將佇列的大小減少到低於目前節點數量，需要先停止運算機群。**  
這些設定可以變更，但如果變更將佇列的大小減少到低於目前大小，則必須停止運算機群 （使用 [`pcluster stop`](pcluster.stop.md))、更新 （使用 [`pcluster update`](pcluster.update.md))，然後建立新的運算機群 （使用 [`pcluster start`](pcluster.start.md))。

**更新政策：減少佇列中的靜態節點數量需要先停止運算機群。**  
這些設定可以變更，但如果變更會減少佇列中靜態節點的數量低於目前大小，則必須停止運算機群 （使用 [`pcluster stop`](pcluster.stop.md))、更新 （使用 [`pcluster update`](pcluster.update.md))，然後建立新的運算機群 （使用 [`pcluster start`](pcluster.start.md))。

**更新政策：如果變更此設定，則不允許更新。無法強制更新此設定。**  
如果現有的叢集尚未刪除，則無法變更這些設定。必須還原變更或刪除叢集 （使用 [`pcluster delete`](pcluster.delete.md))，然後在舊叢集的位置建立新的叢集 （使用 [`pcluster create`](pluster.create.md))。

**更新政策：如果未在組態中指定 AWS ParallelCluster 受管 Amazon FSx for Lustre 檔案系統，則可以在更新期間變更此設定。**  
如果[`[cluster]`](cluster-definition.md)[`fsx_settings`](cluster-definition.md#fsx-settings)未指定 或[`[fsx fs]`](fsx-section.md)同時指定 `fsx_settings`和 [`fsx-fs-id`](fsx-section.md#fsx-fs-id) 來掛載現有的外部 FSx for Lustre 檔案系統，則可以變更此設定。

此範例示範 ，[`pcluster update`](pcluster.update.md)其中包含會封鎖更新的一些變更。

```
$ pcluster update
  Validating configuration file /home/username/.parallelcluster/config...
Retrieving configuration from CloudFormation for cluster test-1...
Found Changes:

#   section/parameter         old value                 new value               
--  ------------------------  ------------------------  ------------------------
    [cluster default]
01* compute_instance_type     t2.micro                  c4.xlarge
02* ebs_settings              ebs2                      -

    [vpc default]
03  additional_sg             sg-0cd61884c4ad16341       sg-0cd61884c4ad11234

    [ebs ebs2]
04* shared_dir                shared                     my/very/very/long/sha...

Validating configuration update...
The requested update cannot be performed. Line numbers with an asterisk indicate 
updates requiring additional actions. Please look at the details below:

#01
Compute fleet must be empty to update "compute_instance_type"
How to fix:
Make sure that there are no jobs running, then run the following command: 
  pcluster stop -c $CONFIG_FILE $CLUSTER_NAME

#02
Cannot add/remove EBS Sections
How to fix:
Revert "ebs_settings" value to "ebs2"

#04
Cannot change the mount dir of an existing EBS volume
How to fix:
Revert "my/very/very/long/shared/dir" to "shared"

In case you want to override these checks and proceed with the update please
use the --force flag. Note that the cluster could end up in an unrecoverable
state.

Update aborted.
```