

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

# 還原 Amazon Redshift 叢集
<a name="redshift-restores"></a>

您可以在 AWS Backup 主控台或透過 CLI 還原自動和手動快照。

當您還原 Amazon Redshift 叢集時，預設會將原始叢集設定輸入至主控台中。您可以為下列組態指定不同的設定。還原資料表時，您必須指定來源和目標資料庫。如需這些組態的詳細資訊，請參閱《Amazon Redshift 管理指南》**中的《[從快照還原叢集](https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html#working-with-snapshot-restore-cluster-from-snapshot)》。
+ **單一資料表或叢集**：您可以選擇還原整個叢集或單一資料表。如果您選擇還原單一資料表，則需要來源資料庫、來源結構描述和來源資料表名稱，以及目標叢集、結構描述和新資料表名稱。
+ **節點類型**：每個 Amazon Redshift 叢集都包含一個領導節點和至少一個運算節點。當您還原叢集時，需要指定符合您 CPU、RAM、儲存容量和磁碟機類型要求的節點類型。
+ **節點數量**：還原叢集時，您需要指定所需的節點數量。
+ **組態摘要**
+ **叢集許可**

## 使用 AWS Backup 主控台還原 Amazon Redshift 叢集或資料表
<a name="redshift-restore-console"></a>

1. 在 https：//[https://console.aws.amazon.com/backup](https://console.aws.amazon.com/backup) 開啟 AWS Backup 主控台。

1. 在導覽窗格中，選擇 **設定** 和您要還原的 Amazon Redshift 資源 ID。

1. **Resource details (資源詳細資訊)** 頁面上會顯示所選資源 ID 的復原點清單。若要還原資源，請在 **復原點** 窗格中，選擇資源復原點 ID 旁的選項按鈕。在窗格右上角，選擇 **Restore (還原)**。

1. 還原選項

   1. 從快照還原叢集，或

   1. 將快照中的單一資料表還原至新叢集。如果您選擇此選項，則必須設定下列項目：

      1. 開啟或關閉「區分大小寫的名稱」。

      1. 輸入來源資料表值，包括資料庫、結構描述和資料表。您可以在 [Amazon Redshift 主控台](https://console.aws.amazon.com/rds/)中找到來源資料表資訊。

      1. 輸入目標資料表值，包括資料庫、結構描述和新資料表名稱。

1. 指定您的新叢集組態設定。

   1. 針對叢集還原：選擇「叢集識別符」、「節點類型」和「節點數量」。

   1. 指定可用區域和維護時段。

   1. 您可以按一下 **關聯 IAM 角色** 來關聯其他角色。

1. 選擇性：**其他組態：

   1. 預設會開啟 **使用預設值**。

   1. 使用下拉式選單選取「網路與安全」、「VPC 安全群組」、「叢集子網路群組」和「可用區域」的設定。

   1. 開啟或關閉 **增強型 VPC 路由**。

   1. 確定是否要讓叢集端點**可公開存取**。如果是，則 VPC 外部的執行個體和裝置可以透過叢集端點連線至您的資料庫。如果開啟此選項，請輸入彈性 IP 地址。

1. 選擇性：**資料庫組態。您可以選擇輸入 

   1. 資料庫連接埠 (透過在文字欄位中輸入)

   1. 參數群組

1. 維護：您可以選擇 

   1. Maintenance window (維護時段)

   1. 維護追蹤 (包括目前、追蹤或預覽)。這可控制在維護時段內套用的叢集版本。

1. 自動快照已設定為預設值。

   1. 自動快照保留期。保留期必須為 0 到 35 天。選擇 0 表示不會建立自動快照。

   1. 手動快照保留期為 1 到 3653 天。

   1. 叢集重新放置有一個選用核取方塊。如果勾選此核取方塊，則允許將您的叢集重新放置在其他可用區域中。啟用重新放置之後，即可使用 VPC 端點。

1. 監控：還原叢集之後，即可透過 CloudWatch 或 Amazon Redshift 設定監控。

1. 選擇要傳遞以執行還原的 IAM 角色。您可以使用預設角色，也可以指定其他角色。

您的還原任務會顯示在 **任務** 下方。您可以按一下「重新整理」按鈕或 CTRL-R 來查看還原任務的目前狀態。

## 使用 API、CLI 或 SDK 還原 Amazon Redshift 叢集
<a name="redshift-restore-api"></a>

使用 [https://docs.aws.amazon.com/aws-backup/latest/devguide/API_StartRestoreJob.html](https://docs.aws.amazon.com/aws-backup/latest/devguide/API_StartRestoreJob.html) 還原 Amazon Redshift 叢集。

若要使用 還原 Amazon Redshift AWS CLI，請使用 命令`start-restore-job`並指定下列中繼資料：

```
ClusterIdentifier // required string
AdditionalInfo // optional string
AllowVersionUpgrade // optional Boolean
AquaConfigurationStatus // optional string
AutomatedSnapshotRetentionPeriod // optional integer 0 to 35
AvailabilityZone // optional string
AvailabilityZoneRelocation // optional Boolean
ClusterParameterGroupName // optional string
ClusterSecurityGroups // optional array of strings
ClusterSubnetGroupName // optional strings
DefaultIamRoleArn // optional string
ElasticIp // optional string
Encrypted // Optional TRUE or FALSE 
EnhancedVpcRouting // optional Boolean 
HsmClientCertificateIdentifier // optional string
HsmConfigurationIdentifier // optional string
IamRoles // optional array of strings
KmsKeyId // optional string
MaintenanceTrackName // optional string
ManageMasterPassword // optional Boolean
ManualSnapshotRetentionPeriod // optional integer
MasterPasswordSecretKmsKeyId // optional string
NodeType // optional string
NumberOfNodes // optional integer
OwnerAccount // optional string
Port // optional integer
PreferredMaintenanceWindow // optional string
PubliclyAccessible // optional Boolean
ReservedNodeId // optional string
SnapshotClusterIdentifier // optional string
SnapshotScheduleIdentifier // optional string
TargetReservedNodeOfferingId // optional string
VpcSecurityGroupIds // optional array of strings
RestoreType // CLUSTER_RESTORE or TABLE_RESTORE or NAMESPACE_RESTORE
```

 如需詳細資訊，請參閱《Amazon Redshift API 參考》**中的 [https://docs.aws.amazon.com/redshift/latest/APIReference/API_RestoreFromClusterSnapshot.html](https://docs.aws.amazon.com/redshift/latest/APIReference/API_RestoreFromClusterSnapshot.html) 和《AWS CLI 指南》**中的 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/redshift/restore-from-cluster-snapshot.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/redshift/restore-from-cluster-snapshot.html)。

以下是範例範本：

```
aws backup start-restore-job \
-\-recovery-point-arn "arn:aws:backup:region:account:snapshot:name
-\-iam-role-arn "arn:aws:iam:account:role/role-name" \
-\-metadata
-\-resource-type Redshift \
-\-region AWS 區域
-\-endpoint-url URL
```

請見此處範例：

```
aws backup start-restore-job \
-\-recovery-point-arn "arn:aws:redshift:us-west-2:123456789012:snapshot:redshift-cluster-1/awsbackup:job-c40dda3c-fdcc-b1ba-fa56-234d23209a40" \
-\-iam-role-arn "arn:aws:iam::974288443796:role/Backup-Redshift-Role" \
-\-metadata 'RestoreType=CLUSTER_RESTORE,ClusterIdentifier=redshift-cluster-restore-78,Encrypted=true,KmsKeyId=45e261e4-075a-46c7-9261-dfb91e1c739c' \
-\-resource-type Redshift \
-\-region us-west-2 \
```

您也可以使用 [https://docs.aws.amazon.com/aws-backup/latest/devguide/API_DescribeRestoreJob.html](https://docs.aws.amazon.com/aws-backup/latest/devguide/API_DescribeRestoreJob.html) 來協助取得還原資訊。

在 中 AWS CLI，使用 操作`describe-restore-job`並使用下列中繼資料：

```
Region
```

以下是範例範本：

```
aws backup describe-restore-job —restore-job-id restore job ID
-\-region AWS 區域
```

請見此處範例：

```
aws backup describe-restore-job -\-restore-job-id BEA3B353-576C-22C0-9E99-09632F262620 \
-\-region us-west-2 \
```