Red/Black 部署和 Blue/Green 部署有什么区别?

What's the difference between Red/Black deployment and Blue/Green Deployment?

我听说这两者都用于描述在新机器上部署更新同时保持旧机器处于活动状态的想法,以便在出现问题时准备好回滚。我还听说它用于描述更新服务和旧服务之间的负载共享,再次用于回滚的目的——有时终止不活动的旧补丁,有时不终止。

我的理解也是严格针对云服务。

有人可以帮助揭开这些术语的神秘面纱吗?

blue/green 和 red/black 部署代表相同的概念。

虽然第一个是最常用的术语,但后者似乎主要用于 Netflix 及其工具(如 Spinnaker)。

它们仅适用于云、虚拟化或容器化服务,因为您的基础设施必须是可自动化的才能理解这种方法。

蓝绿部署

Jez Humble 和 David Farley 在 Continuous Delivery 书中描述的经典部署技术:

The idea is to have two identical versions of your production environment, which we’ll call blue and green... Users of the system are routed to the green environment, which is the currently designated production. We want to release a new version of the application. So we deploy it to the blue environment... This does not in any way affect the operation of the green environment. We can run smoke tests against the blue environment to check it is working properly. When we’re ready, moving to the new version is as simple as changing the router configuration to point to the blue environment instead of the green environment. The blue environment thus becomes production. This switchover can typically be performed in much less than a second. If something goes wrong, we simply switch the router back to the green environment.'

Humble 和 Farley 然后继续提到主要挑战:处理绿色和蓝色版本之间的数据库架构变化。

蓝绿部署的主要好处是发布新版本时停机时间为零或接近零。蓝绿部署启用金丝雀发布.

红黑部署

红色版本正在制作中。您将黑色版本部署到一台或多台服务器。当黑色版本完全运行时,您可以切换路由器以将所有流量定向到它(或者将红色扩展到 0 个实例,将黑色扩展到 N)。如果出现任何问题,您可以恢复该操作。因此,它类似于蓝绿部署,但有一个 细微差别:在蓝绿部署中,两个版本可能会暂时同时收到请求,而在红黑中只有一个版本是随时获取流量。这是一些 corroboration:

At any time, only one of the environments is live, with the live environment serving all production traffic. For this example, Red is currently live and Black is idle (in this case we have kept the Black down-scaled to zero servers)...

因此,红黑是蓝绿的特化。但红黑部署是 Netflix、Istio 和其他支持容器编排的 frameworks/platforms 使用的较新术语。 实际含义可能有所不同,许多人将“红黑”用作“蓝绿”的另一个术语,可能只是因为他们的球队颜色是红色和黑色。 :^)