--- title: "Blue-Green Deployment" type: concept tags: - AWS - Aurora - Database - Deployment - Release Management sources: - ctp-topic-66-exposing-the-differences-between-postgresql-rds-and-aurora last_updated: 2026-04-23 --- ## Overview Blue-Green Deployment(蓝绿部署)是一种零停机部署策略,通过维护两套相同环境(Blue 和 Green)实现快速、平滑的版本切换,最小化部署风险。 ## How It Works 1. **Blue 环境**:当前生产环境 2. **Green 环境**:与 Blue 完全相同的新版本副本 3. **部署过程**: - 在 Green 环境部署和验证新版本 - 验证通过后,将流量从 Blue 切换到 Green - Blue 环境保留作为即时回滚的备用 ## Aurora Blue-Green Deployment Aurora MySQL 支持数据库层的 Blue-Green Deployment,用于 Major Version Upgrade(Maj-Vu): - **原理**:通过逻辑复制(基于 Binlog)将 Blue 环境的变更同步到 Green 环境 - **Guardrails**:内置保护机制防止数据丢失 - **限制**:仅 Aurora MySQL 支持;**Aurora PostgreSQL 不支持** ### vs Traditional Database Upgrade | 方式 | 停机时间 | 风险 | 数据保护 | |------|---------|------|---------| | In-place Major Upgrade | 分钟级,取决于数据大小 | 高,需执行升级脚本 | 依赖备份 | | Blue-Green Deployment | 接近零 | 低,可即时回滚 | 自动保护 | ## Related Concepts - [[Canary Deployment]]:渐进式流量分配,另一种低风险部署策略 - [[Amazon Aurora]]:Aurora MySQL 支持 Blue-Green Deployment - [[Amazon RDS]]:RDS PostgreSQL 不支持 Blue-Green Deployment - [[Release Management]]:蓝绿部署属于发布管理的工具之一 - [[RTO]]:Blue-Green Deployment 可将数据库升级的 RTO 降至接近零 ## Aliases - Blue-Green - Blue Green Deployment - 蓝绿部署 - 双环境部署 - Zero-Downtime Deployment