当部署引入问题时,您需要快速回滚到工作状态,以最小化对用户的影响。有效的回滚策略——以及相关的监控、自动回滚和前向修复实践——对于可靠的部署至关重要。
为什么这很重要
text
Deployments sometimes introduce problems (bugs, errors, performance issues) that get
through testing. When that happens in production:
→ you need to restore a WORKING state QUICKLY (minimize user impact/downtime)
→ a fast, reliable rollback is essential — being able to undo a bad deploy fast
→ "How do we roll back?" must be answered BEFORE you need it.
回滚方法
text
✓ REDEPLOY the previous version — deploy the last known-good artifact/version
(versioned artifacts make this easy: deploy v1.2.2 to undo v1.2.3)
✓ BLUE-GREEN → instant rollback by switching traffic back to the old environment
✓ CANARY → if the canary shows problems, stop the rollout (only a few users affected)
✓ Database changes → trickier (need backward-compatible migrations; see below)
✓ Feature FLAGS → disable a problematic feature without redeploying (instant "rollback"
of behavior)
