

# 从 Amazon Aurora Global Database 删除集群
<a name="aurora-global-database-detaching"></a>

出于多种不同原因，您可以从 Aurora 全局数据库中删除 Aurora 数据库集群。例如，如果主集群被降级或隔离，您可能希望从 Aurora 全局数据库中删除 Aurora 数据库集群。然后，它将成为独立的预置 Aurora 数据库集群，可用于创建新的 Aurora 全局数据库。要了解更多信息，请参阅“[从计划外停机中恢复 Amazon Aurora Global Database](aurora-global-database-disaster-recovery.md#aurora-global-database-failover)”。

您也可能会想要删除 Aurora 数据库集群，因为您想要删除不再需要的 Aurora 全局数据库。在删除（分离）所有关联的 Aurora 数据库集群以后，您才能删除 Aurora 全局数据库，仅保留主数据库。有关更多信息，请参阅“[删除 Amazon Aurora Global Database](aurora-global-database-deleting.md)”。

当 Aurora 数据库集群从 Aurora 全局数据库中分离时，它将不再与主数据库同步。它将成为一个拥有完全读/写功能的独立预置 Aurora 数据库集群。

您可以使用AWS 管理控制台、AWS CLI 或 RDS API 从 Aurora Global Database 中删除 Aurora 数据库集群。

## 控制台
<a name="aurora-global-database-detach.console"></a>

**从 Aurora 全局数据库删除 Aurora 集群**

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

1. 在 **Databases (数据库)** 页面上选择集群。

1. 对于 **Actions (操作)**，选择 **Remove from Global (从全局数据库移除)**。  
![\[显示选择了 Aurora 数据库集群（辅助）和 Remove from global (从全局删除) 操作的屏幕截图。\]](http://docs.aws.amazon.com/zh_cn/AmazonRDS/latest/AuroraUserGuide/images/aurora-global-db-detach-secondary-01.png)

   将会出现一个提示，要求确认您要将辅助集群从 Aurora 全局数据库中分离。  
![\[屏幕截图显示从 Aurora 全局数据库中移除辅助集群的确认提示。\]](http://docs.aws.amazon.com/zh_cn/AmazonRDS/latest/AuroraUserGuide/images/aurora-global-db-detach-secondary-02.png)

1. 选择 **Remove and promote** (删除并提升) 以从全局数据库中删除集群。

Aurora 数据库集群不再作为 Aurora 全局数据库中的辅助集群，也不再与主数据库集群同步。它是一个拥有完全读/写功能的独立 Aurora 数据库集群。

![\[屏幕截图显示从 Aurora 全局数据库中移除辅助集群的确认提示。\]](http://docs.aws.amazon.com/zh_cn/AmazonRDS/latest/AuroraUserGuide/images/aurora-global-db-detach-secondary-03.png)


在移除或删除所有辅助集群后，您可以按同样方式移除主集群。在删除全部辅助集群之前，您无法将主 Aurora 数据库集群从 Aurora 全局数据库中分离（删除）。

Aurora 全局数据库可能保留在**数据库**列表中，其中有零个区域和可用区。如果不想再使用此 Aurora 全局数据库，则可以删除。有关更多信息，请参阅“[删除 Amazon Aurora Global Database](aurora-global-database-deleting.md)”。

## AWS CLI
<a name="aurora-global-database-detach.cli"></a>

 要从 Aurora 全局数据库删除 Aurora 集群，请使用以下参数运行 [remove-from-global-cluster](https://docs.aws.amazon.com/cli/latest/reference/rds/remove-from-global-cluster.html) CLI 命令：
+ `--global-cluster-identifier` – Aurora 全局数据库的名称（标识符）。
+ `--db-cluster-identifier` – 要从 Aurora 全局数据库删除的每个 Aurora 数据库集群的名称。删除主数据库集群之前，先删除所有 Aurora 辅助数据库集群。

 以下示例先从 Aurora 全局数据库中移除辅助集群，然后移除主集群。

对于 Linux、macOS 或 Unix：

```
aws rds --region secondary_region \
  remove-from-global-cluster \
    --db-cluster-identifier secondary_cluster_ARN \
    --global-cluster-identifier global_database_id

aws rds --region primary_region \
  remove-from-global-cluster \
    --db-cluster-identifier primary_cluster_ARN \
    --global-cluster-identifier global_database_id
```

 对 Aurora Global Database 中的每个辅助 AWS 区域 重复 `remove-from-global-cluster --db-cluster-identifier secondary_cluster_ARN ` 命令。

对于 Windows：

```
aws rds --region secondary_region ^
  remove-from-global-cluster ^
    --db-cluster-identifier secondary_cluster_ARN ^
    --global-cluster-identifier global_database_id

aws rds --region primary_region ^
  remove-from-global-cluster ^
    --db-cluster-identifier primary_cluster_ARN ^
    --global-cluster-identifier global_database_id
```

 对 Aurora Global Database 中的每个辅助 `remove-from-global-cluster --db-cluster-identifier secondary_cluster_ARN` 重复 AWS 区域 命令。

## RDS API
<a name="aurora-global-database-detach.api"></a>

 要使用 RDS API 从 Aurora 全局数据库移除 Aurora 集群，请运行 [RemoveFromGlobalCluster](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RemoveFromGlobalCluster.html) 操作。