在Docker Swarm模式下使用副本的主要优势是什么? [英] What's the main advantage of using replicas in Docker Swarm Mode?

查看:449
本文介绍了在Docker Swarm模式下使用副本的主要优势是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力了解Docker Swarm模式下replica实例的概念.我已经读到它是一项有助于提高可用性的功能.

I'm struggling to understand the idea of replica instances in Docker Swarm Mode. I've read that it's a feature that helps with high availability.

但是,即使为该服务定义了1个replica,一个节点发生故障,Docker也会自动在另一个节点上启动新任务.

However, Docker automatically starts up a new task on a different node if one node goes down even with 1 replica defined for the service, which also provides high availability.

那么对于任意服务而言,拥有3个replica实例而不是1个实例有什么好处?我的假设是,有了更多副本,Docker会在发生故障的情况下花费更少的时间在另一个节点上创建新实例,这有助于提高性能.这是正确的吗?

So what's the advantage of having 3 replica instances rather than 1 for an arbitrary service? My assumption was that with more replicas, Docker spends less time creating a new instance on another node in the event of failure, which aids performance. Is this correct?

推荐答案

什么使系统高度可用?

高可用性的目标之一是消除单点故障 基础架构出现故障.单点故障是 技术堆栈中会导致服务的组件 如果无法使用则中断.

One of the goals of high availability is to eliminate single points of failure in your infrastructure. A single point of failure is a component of your technology stack that would cause a service interruption if it became unavailable.


让我们以包含单个实例的副本为例.现在,假设有一个失败. Docker Swarm将注意到该服务失败并重新启动它.该服务将重新启动,但是重新启动不是即时的.假设重新启动需要5秒钟.在这5秒钟内,您的服务不可用.单点故障.


Let's take your example of a replica that consists of a single instance. Now let's suppose there is a failure. Docker Swarm will notice that the service failed and restart it. The service restarts, but a restart isn't instant. Let's say the restart takes 5 seconds. For those 5 seconds your service is unavailable. Single point of failure.

如果您的副本包含3个实例,该怎么办.现在,当其中一个发生故障(没有完美的服务)时,Docker Swarm将注意到其中一个实例不可用,并创建一个新实例.在这段时间内,您仍然有2个运行正常的实例来处理请求.对于您的服务的用户,似乎没有停机时间.该组件不再是单个故障点.

What if you had a replica that consists of 3 instances. Now when one of them fails (no service is perfect), Docker Swarm will notice that one of the instances is unavailable and create a new one. During that time you still have 2 healthy instances serving requests. To a user of your service, it appears as if there was no down time. This component is no longer a single point of failure.

这篇关于在Docker Swarm模式下使用副本的主要优势是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆