Cluster Relocation

Cluster Relocation 过程 把 Redshift 集群从一个 AZ 迁移到另一个 AZ,Endpoint 不变。当 AZ 故障时,集群可以自动或手动迁移到其他 AZ 继续服务。

为什么能做到? 因为 RA3 计算存储分离:

正常状态(AZ-a):
┌─────────────────┐
│  Compute Nodes  │  ← 计算在 AZ-a
│    (AZ-a)       │
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│      RMS        │  ← 数据在 S3(跨 AZ 持久化)
│   (S3 存储)     │
└─────────────────┘

AZ-a 故障后(迁移到 AZ-b):

┌─────────────────┐
│  Compute Nodes  │  ← 新计算节点在 AZ-b
│    (AZ-b)       │     Endpoint 保持不变!
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│      RMS        │  ← 数据还是同一份,没丢
│   (S3 存储)     │
└─────────────────┘

特点:

特性 说明
RPO = 0 数据零丢失(数据在 S3,不受 AZ 影响)
Endpoint 不变 应用不需要改连接串
无需备用集群 故障时才创建,省钱
仅 RA3 支持 DC2/DS2 不支持

触发方式有两种,自动和手动:

自动触发

AWS 检测到 AZ 故障
        │
        ▼
自动在其他 AZ 启动新集群
        │
        ▼
DNS 更新,Endpoint 指向新集群
        │
        ▼
应用自动重连(连接串没变)

手动触发:

-- 通过 AWS CLI 手动触发迁移
aws redshift modify-cluster \
    --cluster-identifier my-cluster \
    --availability-zone us-east-1b

启用方式:

-- 创建集群时启用
aws redshift create-cluster \
    --cluster-identifier my-cluster \
    --node-type ra3.4xlarge \
    --number-of-nodes 2 \
    --availability-zone-relocation-enabled

-- 现有集群启用
aws redshift modify-cluster \
    --cluster-identifier my-cluster \
    --availability-zone-relocation

注意事项:

注意点 说明
本地缓存丢失 新节点需要重新预热
短暂性能下降 缓存预热期间
VPC 配置 目标 AZ 要有合适的子网
安全组 需要在目标 AZ 可用
Elastic IP 如果用了需要重新关联

为当前集群开启relocation

如果开启relocate后,在控制台上能直接relocate:

image-20231127094509923

如果未开启,需要先打开:

image-20231127095726773

image-20231127095746529

然后进行relocate操作:

image-20231127095927595

image-20231127095944610