Files
nexus/wiki/concepts/Blue-Green-Deployment.md
2026-04-22 04:03:04 +08:00

85 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Blue-Green Deployment"
type: concept
tags: [devops, deployment, release-management, high-availability]
date: 2025-03-01
---
## Definition
蓝绿部署Blue-Green Deployment是一种零停机发布策略维护两套相同的生产环境蓝环境和绿环境通过负载均衡器切换流量实现无缝部署和快速回滚。
## Architecture
```
Load Balancer
┌──────────┴──────────┐
│ │
Blue Env Green Env
(Production) (Staging)
│ │
v1.0 v1.1 (New)
Traffic ON Traffic OFF
```
## Deployment Flow
```
1. Blue (v1.0) serving all traffic
2. Deploy to Green (v1.1)
3. Test/Verify Green
4. Switch LB to Green
5. Blue becomes standby (or update to next version)
```
## Key Benefits
| 优势 | 描述 |
|------|------|
| 零停机 | 流量切换瞬间完成 |
| 快速回滚 | 切换回蓝色环境即可 |
| 测试完整性 | 完整生产环境测试 |
| 风险可控 | 新版本未暴露给全部用户 |
## Comparison: Blue-Green vs Canary
| 维度 | Blue-Green | Canary |
|------|-----------|--------|
| 流量切换 | 全量切换 | 渐进式 |
| 回滚速度 | 秒级 | 秒级 |
| 资源成本 | 2x | 增量 |
| 适用场景 | 关键系统 | 持续迭代 |
| 风险 | 全量暴露 | 逐步暴露 |
## In ITSM Context
在[[ITSM 2.0]]的[[Release-Management]]中,蓝绿部署是关键实践:
```
Release Management 2.0
├── Blue-Green Deployment
│ ├── 零停机发布
│ ├── 秒级回滚
│ └── 全量验证
├── Canary Release
│ ├── 渐进式发布
│ └── 实时监控
└── DevOps-integrated ITSM
├── CI/CD Pipeline
└── Automated Governance
```
## Related Concepts
- [[Release-Management]] — 发布管理总框架
- [[Canary-Release]] — 金丝雀发布
- [[High-Availability]] — 高可用架构
- [[Failover]] — 故障转移
- [[Deployment-Automation]] — 部署自动化
## Sources
- [[understanding-complete-itsm]] — Blue-Green在现代ITSM中的应用