

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

# Shadow 管理員
<a name="shadow-manager-component"></a>

影子管理員元件 (`aws.greengrass.ShadowManager`) 會在您的核心裝置上啟用本機影子服務。本機影子服務允許元件使用程序間通訊與[本機影子互動](ipc-local-shadows.md)。影子管理員元件會管理本機影子文件的儲存，也會處理本機影子狀態與 AWS IoT Device Shadow 服務的同步處理。

如需 Greengrass 核心裝置如何與影子互動的詳細資訊，請參閱 [與裝置陰影互動](interact-with-shadows.md)。

**Topics**
+ [版本](#shadow-manager-component-versions)
+ [Type](#shadow-manager-component-type)
+ [作業系統](#shadow-manager-component-os-support)
+ [要求](#shadow-manager-component-requirements)
+ [相依性](#shadow-manager-component-dependencies)
+ [Configuration](#shadow-manager-component-configuration)
+ [本機日誌檔案](#shadow-manager-component-log-file)
+ [變更記錄](#shadow-manager-component-changelog)

## 版本
<a name="shadow-manager-component-versions"></a>

此元件具有下列版本：
+ 2.3.x 版本
+ 2.2.x 版本
+ 2.1.x
+ 2.0.x

## Type
<a name="shadow-manager-component-type"></a>

<a name="public-component-type-plugin-para1"></a>此元件是外掛程式元件 (`aws.greengrass.plugin`)。[Greengrass 核心](greengrass-nucleus-component.md)會在與核心相同的 Java 虛擬機器 (JVM) 中執行此元件。當您在核心裝置上變更此元件的版本時，核會重新啟動。

<a name="public-component-type-plugin-para2"></a>此元件使用與 Greengrass 核相同的日誌檔案。如需詳細資訊，請參閱[監控 AWS IoT Greengrass 日誌](monitor-logs.md)。

<a name="public-component-type-more-information"></a>如需詳細資訊，請參閱[元件類型](develop-greengrass-components.md#component-types)。

## 作業系統
<a name="shadow-manager-component-os-support"></a>

此元件可以安裝在執行下列作業系統的核心裝置上：
+ Linux
+ Windows

## 要求
<a name="shadow-manager-component-requirements"></a>

此元件有下列需求：
+ （選用） 若要將影子同步至 AWS IoT Device Shadow 服務，Greengrass 核心裝置 AWS IoT 的政策必須允許下列 AWS IoT Core 影子政策動作：
  + `iot:GetThingShadow`
  + `iot:UpdateThingShadow`
  + `iot:DeleteThingShadow`

  如需這些 AWS IoT Core 政策的詳細資訊，請參閱《 *AWS IoT 開發人員指南*》中的[AWS IoT Core 政策動作](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policy-actions.html)。

  如需最低 AWS IoT 政策的詳細資訊，請參閱 [AWS IoT Greengrass V2 核心裝置的最低 AWS IoT 政策](device-auth.md#greengrass-core-minimal-iot-policy)
+ 影子管理員元件支援在 VPC 中執行。

## 相依性
<a name="shadow-manager-component-dependencies"></a>

當您部署元件時， AWS IoT Greengrass 也會部署其相依性的相容版本。這表示您必須符合元件及其所有相依性的要求，才能成功部署元件。本節列出此元件[發行版本的](#shadow-manager-component-changelog)相依性，以及為每個相依性定義元件版本的語意版本限制。您也可以在 [AWS IoT Greengrass 主控台](https://console.aws.amazon.com//greengrass)中檢視每個版本元件的相依性。在元件詳細資訊頁面上，尋找**相依性**清單。

------
#### [ 2.3.13 ]

下表列出此元件 2.3.13 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.17.0 | 軟式 | 

------
#### [ 2.3.12 ]

下表列出此元件 2.3.12 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.17.0 | 軟式 | 

------
#### [ 2.3.11 ]

下表列出此元件 2.3.11 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.16.0 | 軟式 | 

------
#### [ 2.3.10 ]

下表列出此元件 2.3.10 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.15.0 | 軟式 | 

------
#### [ 2.3.9 ]

下表列出此元件 2.3.9 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.14.0 | 軟式 | 

------
#### [ 2.3.5 – 2.3.8 ]

下表列出此元件 2.3.5 到 2.3.8 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.13.0 | 軟式 | 

------
#### [ 2.3.3 and 2.3.4 ]

下表列出此元件 2.3.3 和 2.3.4 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.12.0 | 軟式 | 

------
#### [ 2.3.2 ]

下表列出此元件 2.3.2 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.11.0 | 軟式 | 

------
#### [ 2.3.0 and 2.3.1 ]

下表列出此元件 2.3.0 和 2.3.1 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.5.0 <2.10.0 | 軟式 | 

------
#### [ 2.2.3 and 2.2.4 ]

下表列出此元件 2.2.3 和 2.2.4 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <3.0.0 | 軟式 | 

------
#### [ 2.2.2 ]

下表列出此元件 2.2.2 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <2.9.0 | 軟式 | 

------
#### [ 2.2.1 ]

下表列出此元件 2.2.1 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <2.8.0 | 軟式 | 

------
#### [ 2.1.1 and 2.2.0 ]

下表列出此元件 2.1.1 和 2.2.0 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <2.7.0 | 軟式 | 

------
#### [ 2.0.5 - 2.1.0 ]

下表列出此元件 2.0.5 到 2.1.0 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <2.6.0 | 軟式 | 

------
#### [ 2.0.3 and 2.0.4 ]

下表列出此元件 2.0.3 和 2.0.4 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <2.5.0 | 軟式 | 

------
#### [ 2.0.1 and 2.0.2 ]

下表列出此元件 2.0.1 和 2.0.2 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <2.4.0 | 軟式 | 

------
#### [ 2.0.0 ]

下表列出此元件 2.0.0 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) | >=2.2.0 <2.3.0 | 軟式 | 

------

如需元件相依性的詳細資訊，請參閱[元件配方參考](component-recipe-reference.md#recipe-reference-component-dependencies)。

## Configuration
<a name="shadow-manager-component-configuration"></a>

此元件提供下列組態參數，您可以在部署元件時自訂這些參數。

------
#### [ 2.3.x ]

`strategy`  <a name="shadow-manager-component-configuration-strategy"></a>
（選用） 此元件用來在 AWS IoT Core 和核心裝置之間同步陰影的策略。  
此物件包含下列資訊。    
`type`  
（選用） 此元件用來在 AWS IoT Core 和 核心裝置之間同步陰影的策略類型。您可以從以下選項中選擇：  
+ `realTime` – AWS IoT Core 每次進行陰影更新時，同步陰影。
+ `periodic` – AWS IoT Core 以您使用`delay`組態參數指定的定期間隔將陰影與 同步。
預設：`realTime`  
`delay`  
（選用） 當您指定同步策略時 AWS IoT Core，此元件與 `periodic`同步陰影的間隔，以秒為單位。  
如果您指定`periodic`同步策略，則需要此參數。

`synchronize`  <a name="shadow-manager-component-configuration-synchronize"></a>
<a name="shadow-manager-component-configuration-strategy-description"></a>（選用） 決定影子如何與 同步的同步設定 AWS 雲端。  
您必須使用此屬性建立組態更新，才能與 同步陰影 AWS 雲端。
此物件包含下列資訊。    
`coreThing`  <a name="shadow-manager-component-configuration-synchronize-core-thing"></a>
（選用） 要同步的核心裝置陰影。此物件包含下列資訊。    
`classic`  
（選用） 根據預設，影子管理員會使用 同步核心裝置傳統影子的本機狀態 AWS 雲端。如果您不想同步傳統裝置影子，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 要同步的具名核心裝置影子清單。您必須指定影子的確切名稱。  
 AWS IoT Greengrass 服務使用`AWSManagedGreengrassV2Deployment`具名影子來管理以個別核心裝置為目標的部署。此具名影子會保留供 AWS IoT Greengrass 服務使用。請勿更新或刪除此具名影子。  
`shadowDocumentsMap`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents-map"></a>
（選用） 要同步的其他裝置陰影。使用此組態參數可讓您更輕鬆地指定影子文件。我們建議您使用此參數，而非 `shadowDocuments` 物件。  
如果您指定`shadowDocumentsMap`物件，則不得指定`shadowDocuments`物件。
每個物件都包含下列資訊：    
*`thingName`*  
此影子組態之 *thingName* 的影子組態。    
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置影子，請將此設為 `false`。  
`namedShadows`  
您要同步的具名影子清單。您必須指定影子的確切名稱。  
`shadowDocuments`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents"></a>
（選用） 要同步的其他裝置陰影清單。我們建議您改用 `shadowDocumentsMap` 參數。  
如果您指定`shadowDocuments`物件，則不得指定`shadowDocumentsMap`物件。
此清單中的每個物件都包含下列資訊。    
`thingName`  
要同步陰影之裝置的物件名稱。  
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置影子，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 您要同步的具名裝置陰影清單。您必須指定影子的確切名稱。  
`direction`  
（選用） 在本機影子服務與 之間同步影子的方向 AWS 雲端。您可以設定此選項，以減少頻寬和對 的連線 AWS 雲端。您可以從以下選項中選擇：  
+ `betweenDeviceAndCloud` – 同步本機影子服務與 之間的影子 AWS 雲端。
+ `deviceToCloud` – 將陰影更新從本機陰影服務傳送至 AWS 雲端，並忽略來自 的陰影更新 AWS 雲端。
+ `cloudToDevice` – 從 接收陰影更新 AWS 雲端，而且不要從本機陰影服務傳送陰影更新至 AWS 雲端。
預設：`BETWEEN_DEVICE_AND_CLOUD`

`rateLimits`  <a name="shadow-manager-component-configuration-rate-limits"></a>
（選用） 決定陰影服務請求速率限制的設定。  
此物件包含下列資訊。    
`maxOutboundSyncUpdatesPerSecond`  
（選用） 裝置每秒傳輸的同步請求數目上限。  
預設：100 個請求/秒  
`maxTotalLocalRequestsRate`  
（選用） 每秒傳送至核心裝置的本機 IPC 請求數量上限。  
預設：200 個請求/秒  
`maxLocalRequestsPerSecondPerThing`  
（選用） 每秒針對每個連線 IoT 物件傳送的本機 IPC 請求數目上限。  
預設：每個物件每秒 20 個請求
這些速率限制參數會定義本機影子服務的每秒請求數上限。 AWS IoT Device Shadow 服務的每秒請求數上限取決於您的 AWS 區域。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。

`shadowDocumentSizeLimitBytes`  <a name="shadow-manager-component-configuration-shadow-document-size-limit-bytes"></a>
（選用） 本機影子的每個 JSON 狀態文件允許的大小上限。  
如果您增加此值，您還必須增加雲端影子的 JSON 狀態文件的資源限制。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。  
預設：8192 位元組  
上限：30720 位元組

**Example 範例：組態合併更新**  
下列範例顯示範例組態合併更新，其中包含影子管理員元件的所有可用組態參數。  

```
{
   "strategy":{
      "type":"periodic",
      "delay":300
   },
   "synchronize":{
      "shadowDocumentsMap":{
         "MyDevice1":{
            "classic":false,
            "namedShadows":[
               "MyShadowA",
               "MyShadowB"
            ]
         },
         "MyDevice2":{
            "classic":true,
            "namedShadows":[]
         }
      },
      "direction":"betweenDeviceAndCloud"
   },
   "rateLimits":{
      "maxOutboundSyncUpdatesPerSecond":100,
      "maxTotalLocalRequestsRate":200,
      "maxLocalRequestsPerSecondPerThing":20
   },
   "shadowDocumentSizeLimitBytes":8192
}
```

------
#### [ 2.2.x ]

`strategy`  <a name="shadow-manager-component-configuration-strategy"></a>
（選用） 此元件用來在 AWS IoT Core 和核心裝置之間同步陰影的策略。  
此物件包含下列資訊。    
`type`  
（選用） 此元件用來在 AWS IoT Core 和核心裝置之間同步陰影的策略類型。您可以從以下選項中選擇：  
+ `realTime` – AWS IoT Core 每次進行陰影更新時，同步陰影。
+ `periodic` – AWS IoT Core 以您使用`delay`組態參數指定的定期間隔，將陰影與 同步。
預設：`realTime`  
`delay`  
（選用） 當您指定同步策略時 AWS IoT Core，此元件與 `periodic`同步陰影的間隔，以秒為單位。  
如果您指定`periodic`同步策略，則需要此參數。

`synchronize`  <a name="shadow-manager-component-configuration-synchronize"></a>
<a name="shadow-manager-component-configuration-strategy-description"></a>（選用） 決定影子如何與 同步的同步設定 AWS 雲端。  
您必須使用此屬性建立組態更新，才能將影子與 同步 AWS 雲端。
此物件包含下列資訊。    
`coreThing`  <a name="shadow-manager-component-configuration-synchronize-core-thing"></a>
（選用） 要同步的核心裝置陰影。此物件包含下列資訊。    
`classic`  
（選用） 根據預設，影子管理員會使用 同步核心裝置傳統影子的本機狀態 AWS 雲端。如果您不想同步傳統裝置影子，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 要同步的具名核心裝置陰影清單。您必須指定影子的確切名稱。  
 AWS IoT Greengrass 服務使用`AWSManagedGreengrassV2Deployment`具名影子來管理以個別核心裝置為目標的部署。此具名影子會保留供 AWS IoT Greengrass 服務使用。請勿更新或刪除此具名影子。  
`shadowDocumentsMap`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents-map"></a>
（選用） 要同步的其他裝置陰影。使用此組態參數可讓您更輕鬆地指定影子文件。我們建議您使用此參數，而非 `shadowDocuments` 物件。  
如果您指定`shadowDocumentsMap`物件，則不得指定`shadowDocuments`物件。
每個物件都包含下列資訊：    
*`thingName`*  
此影子組態之 *thingName* 的影子組態。    
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置陰影，請將此設為 `false`。  
`namedShadows`  
您要同步的具名影子清單。您必須指定影子的確切名稱。  
`shadowDocuments`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents"></a>
（選用） 要同步的其他裝置陰影清單。我們建議您改用 `shadowDocumentsMap` 參數。  
如果您指定`shadowDocuments`物件，則不得指定`shadowDocumentsMap`物件。
此清單中的每個物件都包含下列資訊。    
`thingName`  
要同步陰影之裝置的物件名稱。  
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置陰影，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 您要同步的具名裝置陰影清單。您必須指定影子的確切名稱。  
`direction`  
（選用） 在本機影子服務與 之間同步影子的方向 AWS 雲端。您可以設定此選項，以減少頻寬和對 的連線 AWS 雲端。您可以從以下選項中選擇：  
+ `betweenDeviceAndCloud` – 同步本機影子服務與 之間的影子 AWS 雲端。
+ `deviceToCloud` – 將陰影更新從本機陰影服務傳送至 AWS 雲端，並忽略來自 的陰影更新 AWS 雲端。
+ `cloudToDevice` – 從 接收陰影更新 AWS 雲端，而且不要將陰影更新從本機陰影服務傳送至 AWS 雲端。
預設：`BETWEEN_DEVICE_AND_CLOUD`

`rateLimits`  <a name="shadow-manager-component-configuration-rate-limits"></a>
（選用） 決定陰影服務請求速率限制的設定。  
此物件包含下列資訊。    
`maxOutboundSyncUpdatesPerSecond`  
（選用） 裝置每秒傳輸的同步請求數目上限。  
預設：100 個請求/秒  
`maxTotalLocalRequestsRate`  
（選用） 每秒傳送至核心裝置的本機 IPC 請求數目上限。  
預設：200 個請求/秒  
`maxLocalRequestsPerSecondPerThing`  
（選用） 每秒針對每個連線 IoT 物件傳送的本機 IPC 請求數目上限。  
預設：每個物件每秒 20 個請求
這些速率限制參數會定義本機影子服務的每秒請求數上限。 AWS IoT Device Shadow 服務的每秒請求數上限取決於您的 AWS 區域。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。

`shadowDocumentSizeLimitBytes`  <a name="shadow-manager-component-configuration-shadow-document-size-limit-bytes"></a>
（選用） 本機影子的每個 JSON 狀態文件允許的大小上限。  
如果您增加此值，您還必須增加雲端影子的 JSON 狀態文件的資源限制。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。  
預設：8192 位元組  
上限：30720 位元組

**Example 範例：組態合併更新**  
下列範例顯示範例組態合併更新，其中包含影子管理員元件的所有可用組態參數。  

```
{
   "strategy":{
      "type":"periodic",
      "delay":300
   },
   "synchronize":{
      "shadowDocumentsMap":{
         "MyDevice1":{
            "classic":false,
            "namedShadows":[
               "MyShadowA",
               "MyShadowB"
            ]
         },
         "MyDevice2":{
            "classic":true,
            "namedShadows":[]
         }
      },
      "direction":"betweenDeviceAndCloud"
   },
   "rateLimits":{
      "maxOutboundSyncUpdatesPerSecond":100,
      "maxTotalLocalRequestsRate":200,
      "maxLocalRequestsPerSecondPerThing":20
   },
   "shadowDocumentSizeLimitBytes":8192
}
```

------
#### [ 2.1.x ]

`strategy`  <a name="shadow-manager-component-configuration-strategy"></a>
（選用） 此元件用來在 AWS IoT Core 和核心裝置之間同步陰影的策略。  
此物件包含下列資訊。    
`type`  
（選用） 此元件用來在 AWS IoT Core 和核心裝置之間同步陰影的策略類型。您可以從以下選項中選擇：  
+ `realTime` – AWS IoT Core 每次進行陰影更新時，同步陰影。
+ `periodic` – AWS IoT Core 以您使用`delay`組態參數指定的定期間隔，將陰影與 同步。
預設：`realTime`  
`delay`  
（選用） 當您指定同步策略時 AWS IoT Core，此元件與 `periodic`同步陰影的間隔，以秒為單位。  
如果您指定`periodic`同步策略，則需要此參數。

`synchronize`  <a name="shadow-manager-component-configuration-synchronize"></a>
<a name="shadow-manager-component-configuration-strategy-description"></a>（選用） 決定影子如何與 同步的同步設定 AWS 雲端。  
您必須使用此屬性建立組態更新，才能將影子與 同步 AWS 雲端。
此物件包含下列資訊。    
`coreThing`  <a name="shadow-manager-component-configuration-synchronize-core-thing"></a>
（選用） 要同步的核心裝置陰影。此物件包含下列資訊。    
`classic`  
（選用） 根據預設，影子管理員會使用 同步核心裝置傳統影子的本機狀態 AWS 雲端。如果您不想同步傳統裝置影子，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 要同步的具名核心裝置陰影清單。您必須指定影子的確切名稱。  
 AWS IoT Greengrass 服務使用`AWSManagedGreengrassV2Deployment`具名影子來管理以個別核心裝置為目標的部署。此具名影子會保留供 AWS IoT Greengrass 服務使用。請勿更新或刪除此具名影子。  
`shadowDocumentsMap`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents-map"></a>
（選用） 要同步的其他裝置陰影。使用此組態參數可讓您更輕鬆地指定影子文件。我們建議您使用此參數，而非 `shadowDocuments` 物件。  
如果您指定`shadowDocumentsMap`物件，則不得指定`shadowDocuments`物件。
每個物件都包含下列資訊：    
*`thingName`*  
此影子組態之 *thingName* 的影子組態。    
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置陰影，請將此設為 `false`。  
`namedShadows`  
您要同步的具名影子清單。您必須指定影子的確切名稱。  
`shadowDocuments`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents"></a>
（選用） 要同步的其他裝置陰影清單。我們建議您改用 `shadowDocumentsMap` 參數。  
如果您指定`shadowDocuments`物件，則不得指定`shadowDocumentsMap`物件。
此清單中的每個物件都包含下列資訊。    
`thingName`  
要同步陰影之裝置的物件名稱。  
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置陰影，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 您要同步的具名裝置陰影清單。您必須指定影子的確切名稱。

`rateLimits`  <a name="shadow-manager-component-configuration-rate-limits"></a>
（選用） 決定陰影服務請求速率限制的設定。  
此物件包含下列資訊。    
`maxOutboundSyncUpdatesPerSecond`  
（選用） 裝置每秒傳輸的同步請求數目上限。  
預設：100 個請求/秒  
`maxTotalLocalRequestsRate`  
（選用） 每秒傳送至核心裝置的本機 IPC 請求數量上限。  
預設：200 個請求/秒  
`maxLocalRequestsPerSecondPerThing`  
（選用） 每秒針對每個連線 IoT 物件傳送的本機 IPC 請求數目上限。  
預設：每個物件每秒 20 個請求
這些速率限制參數會定義本機影子服務的每秒請求數上限。 AWS IoT Device Shadow 服務的每秒請求數上限取決於您的 AWS 區域。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。

`shadowDocumentSizeLimitBytes`  <a name="shadow-manager-component-configuration-shadow-document-size-limit-bytes"></a>
（選用） 本機影子的每個 JSON 狀態文件允許的大小上限。  
如果您增加此值，您還必須增加雲端影子的 JSON 狀態文件的資源限制。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。  
預設：8192 位元組  
上限：30720 位元組

**Example 範例：組態合併更新**  
下列範例顯示範例組態合併更新，其中包含影子管理員元件的所有可用組態參數。  

```
{
   "strategy":{
      "type":"periodic",
      "delay":300
   },
   "synchronize":{
      "shadowDocumentsMap":{
         "MyDevice1":{
            "classic":false,
            "namedShadows":[
               "MyShadowA",
               "MyShadowB"
            ]
         },
         "MyDevice2":{
            "classic":true,
            "namedShadows":[]
         }
      },
      "direction":"betweenDeviceAndCloud"
   },
   "rateLimits":{
      "maxOutboundSyncUpdatesPerSecond":100,
      "maxTotalLocalRequestsRate":200,
      "maxLocalRequestsPerSecondPerThing":20
   },
   "shadowDocumentSizeLimitBytes":8192
}
```

------
#### [ 2.0.x ]

`synchronize`  <a name="shadow-manager-component-configuration-synchronize"></a>
<a name="shadow-manager-component-configuration-strategy-description"></a>（選用） 決定影子如何與 同步的同步設定 AWS 雲端。  
您必須使用此屬性建立組態更新，才能與 同步陰影 AWS 雲端。
此物件包含下列資訊。    
`coreThing`  <a name="shadow-manager-component-configuration-synchronize-core-thing"></a>
（選用） 要同步的核心裝置陰影。此物件包含下列資訊。    
`classic`  
（選用） 根據預設，影子管理員會使用 同步核心裝置傳統影子的本機狀態 AWS 雲端。如果您不想同步傳統裝置影子，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 要同步的具名核心裝置影子清單。您必須指定影子的確切名稱。  
 AWS IoT Greengrass 服務使用`AWSManagedGreengrassV2Deployment`具名影子來管理以個別核心裝置為目標的部署。此具名影子會保留供 AWS IoT Greengrass 服務使用。請勿更新或刪除此具名影子。  
`shadowDocumentsMap`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents-map"></a>
（選用） 要同步的其他裝置陰影。使用此組態參數可讓您更輕鬆地指定影子文件。我們建議您使用此參數，而非 `shadowDocuments` 物件。  
如果您指定`shadowDocumentsMap`物件，則不得指定`shadowDocuments`物件。
每個物件都包含下列資訊：    
*`thingName`*  
此影子組態之 *thingName* 的影子組態。    
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置影子，請將此設為 `false`。  
`namedShadows`  
您要同步的具名影子清單。您必須指定影子的確切名稱。  
`shadowDocuments`  <a name="shadow-manager-component-configuration-synchronize-shadow-documents"></a>
（選用） 要同步的其他裝置陰影清單。我們建議您改用 `shadowDocumentsMap` 參數。  
如果您指定`shadowDocuments`物件，則不得指定`shadowDocumentsMap`物件。
此清單中的每個物件都包含下列資訊。    
`thingName`  
要同步陰影之裝置的物件名稱。  
`classic`  
（選用） 如果您不想同步`thingName`裝置的傳統裝置影子，請將此設為 `false`。  
預設：`true`  
`namedShadows`  
（選用） 您要同步的具名裝置陰影清單。您必須指定影子的確切名稱。

`rateLimits`  <a name="shadow-manager-component-configuration-rate-limits"></a>
（選用） 決定陰影服務請求速率限制的設定。  
此物件包含下列資訊。    
`maxOutboundSyncUpdatesPerSecond`  
（選用） 裝置每秒傳輸的同步請求數目上限。  
預設：100 個請求/秒  
`maxTotalLocalRequestsRate`  
（選用） 每秒傳送至核心裝置的本機 IPC 請求數量上限。  
預設：200 個請求/秒  
`maxLocalRequestsPerSecondPerThing`  
（選用） 每秒針對每個連線 IoT 物件傳送的本機 IPC 請求數目上限。  
預設：每個物件每秒 20 個請求
這些速率限制參數會定義本機影子服務的每秒請求數上限。 AWS IoT Device Shadow 服務的每秒請求數上限取決於您的 AWS 區域。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。

`shadowDocumentSizeLimitBytes`  <a name="shadow-manager-component-configuration-shadow-document-size-limit-bytes"></a>
（選用） 本機影子的每個 JSON 狀態文件允許的大小上限。  
如果您增加此值，您還必須增加雲端影子的 JSON 狀態文件的資源限制。如需詳細資訊，請參閱《》中 [AWS IoT Device Shadow Service API](https://docs.aws.amazon.com/general/latest/gr/iot-core.html#device-shadow-limits) 的限制*Amazon Web Services 一般參考*。  
預設：8192 位元組  
上限：30720 位元組

**Example 範例：組態合併更新**  
下列範例顯示範例組態合併更新，其中包含影子管理員元件的所有可用組態參數。  

```
{
  "synchronize": {
    "coreThing": {
      "classic": true,
      "namedShadows": [
        "MyCoreShadowA",
        "MyCoreShadowB"
      ]
    },
    "shadowDocuments": [
      {
        "thingName": "MyDevice1",
        "classic": false,
        "namedShadows": [
          "MyShadowA",
          "MyShadowB"
        ]
      },
      {
        "thingName": "MyDevice2",
        "classic": true,
        "namedShadows": []
      }
    ]
  },
  "rateLimits": {       
    "maxOutboundSyncUpdatesPerSecond": 100,
    "maxTotalLocalRequestsRate": 200,
    "maxLocalRequestsPerSecondPerThing": 20
  },
  "shadowDocumentSizeLimitBytes": 8192
}
```

------

## 本機日誌檔案
<a name="shadow-manager-component-log-file"></a>

此元件使用與 [Greengrass 核](greengrass-nucleus-component.md)元件相同的日誌檔案。

------
#### [ Linux ]

```
/greengrass/v2/logs/greengrass.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\greengrass.log
```

------

**檢視此元件的日誌**
+ 在核心裝置上執行下列命令，以即時檢視此元件的日誌檔案。將 `/greengrass/v2`或 *C：\$1greengrass\$1v2* 取代為 AWS IoT Greengrass 根資料夾的路徑。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/greengrass.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\greengrass.log -Tail 10 -Wait
  ```

------

## 變更記錄
<a name="shadow-manager-component-changelog"></a>

下表說明每個版本元件的變更。


|  版本  |  變更  | 
| --- | --- | 
|  2.3.13  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.3.12  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.3.11  | 針對 Greengrass nucleus 2.15.0 版更新版本。 | 
|  2.3.10  | 針對 Greengrass nucleus 2.14.0 版更新版本。 | 
|  2.3.9  | 針對 Greengrass nucleus 2.13.0 版更新版本。 | 
|  2.3.8  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.3.7  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.3.6  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.3.5  | 針對 Greengrass nucleus 2.12.0 版更新版本。 | 
|  2.3.4  |  <a name="changelog-shadow-manager-2.3.4"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html)  | 
|  2.3.3  | 針對 Greengrass nucleus 2.11.0 版更新版本。 | 
|  2.3.2  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.3.1  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.3.0  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.2.4  | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html) | 
|  2.2.3  | 針對 Greengrass nucleus 2.9.0 版更新版本。 | 
|  2.2.2  | 針對 Greengrass nucleus 2.8.0 版更新版本。 | 
|  2.2.1  |  針對 Greengrass nucleus 2.7.0 版更新版本。  | 
|  2.2.0  |  <a name="changelog-shadow-manager-2.2.0"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html)  | 
|  2.1.1  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html)  | 
|  2.1.0  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html)  | 
|  2.0.6  |  此版本包含錯誤修正和改善。  | 
|  2.0.5  |  針對 Greengrass nucleus 2.5.0 版更新版本。  | 
|  2.0.4  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html)  | 
|  2.0.3  |  針對 Greengrass nucleus 2.4.0 版更新版本。  | 
|  2.0.2  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/shadow-manager-component.html)  | 
|  2.0.1  |  針對 Greengrass nucleus 2.3.0 版更新版本。  | 
|  2.0.0  |  初始版本。  | 