

# 创建数据库集群快照
<a name="USER_CreateSnapshotCluster"></a><a name="create_snapshot"></a>

Amazon RDS 创建数据库集群的存储卷快照，并备份整个数据库集群而不仅仅是单个数据库。创建数据库集群快照时，您需要标识要备份的数据库集群，然后为数据库集群快照命名，以便稍后从此快照还原。创建数据库集群快照所用时间因数据库大小而异。由于快照包含整个存储卷，因此，文件（如临时文件）的大小也会影响创建快照所需的时间。

**注意**  
您的数据库集群必须处于 `available` 状态才能拍摄数据库集群快照。

与自动备份不同，手动快照不受备份保留期的限制。快照不会过期。

对于非常长期的备份，我们建议将快照数据导出到 Amazon S3。如果不再支持数据库引擎的主要版本，则无法从快照还原到该版本。有关更多信息，请参阅 [将数据库集群快照数据导出到 Amazon S3](aurora-export-snapshot.md)。

您可以使用 AWS 管理控制台、AWS CLI 或 RDS API 创建数据库集群快照。

## 控制台
<a name="USER_CreateSnapshotCluster.CON"></a>

**创建数据库集群快照**

1. 登录AWS 管理控制台并通过以下网址打开 Amazon RDS 控制台：[https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/)。

1. 在导航窗格中，选择**快照**。

   将显示**手动快照**列表。

1. 选择**拍摄快照**。

   将显示 **Take DB snapshot (拍摄数据库快照)** 窗口。

1. 对于**快照类型**，请选择**数据库集群**。  
![\[拍摄数据库快照。\]](http://docs.aws.amazon.com/zh_cn/AmazonRDS/latest/AuroraUserGuide/images/take_db_cluster_snapshot.png)

1. 选择要为其拍摄快照的**数据库集群**。

1. 输入**快照名称**。

1. 选择**拍摄快照**。

   将显示**手动快照**列表，其中新的数据库集群快照的状态显示为 `Creating`。在其状态为 `Available` 后，您可以看到其创建时间。

## AWS CLI
<a name="USER_CreateSnapshotCluster.CLI"></a>

在使用 AWS CLI 创建数据库集群快照时，您需要指定要备份的数据库集群，然后指定数据库集群快照名称，以便以后从该快照还原。结合以下参数使用 AWS CLI [https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-cluster-snapshot.html](https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-cluster-snapshot.html) 命令执行该操作：
+ `--db-cluster-identifier`
+ `--db-cluster-snapshot-identifier`

在该示例中，您为名为 *mydbcluster* 的数据库集群创建名为 *mydbclustersnapshot* 的数据库集群快照。

**Example**  
对于 Linux、macOS 或 Unix：  

```
1. aws rds create-db-cluster-snapshot \
2.     --db-cluster-identifier mydbcluster \
3.     --db-cluster-snapshot-identifier mydbclustersnapshot
```
对于：Windows  

```
1. aws rds create-db-cluster-snapshot ^
2.     --db-cluster-identifier mydbcluster ^
3.     --db-cluster-snapshot-identifier mydbclustersnapshot
```

## RDS API
<a name="USER_CreateSnapshotCluster.API"></a>

在使用 Amazon RDS API 创建数据库集群快照时，您需要指定要备份的数据库集群，然后指定数据库集群快照名称，以便以后从该快照还原。您可以使用具有以下参数的 Amazon RDS API [https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBClusterSnapshot.html](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBClusterSnapshot.html) 命令执行该操作：
+ DBClusterIdentifier
+ DBClusterSnapshotIdentifier

## 确定数据库集群快照是否可用
<a name="USER_CreateSnapshotCluster.Available"></a>

您可通过下列方式检查数据库集群快照是否可用：在 AWS 管理控制台中的集群详情页面上查看**维护和备份**选项卡下的**快照**，使用 [https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-cluster-snapshots](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-cluster-snapshots) CLI 命令，或者使用 [https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBClusterSnapshots.html](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBClusterSnapshots.html) API 操作。

您也可以使用 [https://docs.aws.amazon.com/cli/latest/reference/rds/wait/db-cluster-snapshot-available.html](https://docs.aws.amazon.com/cli/latest/reference/rds/wait/db-cluster-snapshot-available.html) CLI 命令每 30 秒轮询一次 API，直到快照可用。