Can Swarm handle failure?
One word answer is, yes, it can.
But more interesting part is, how?
Let's take the previous example of the service running
three replicas of Nginx, each hosted on one worker
or master and our workers are healthy and running.
What if one of the workers go down?
Let's say in this case, worker 3 went down. If that
happens, the task 3 will be sheduled on one
of the other workers. Once worker 3 is back to
its running state, task three might get moved back to it
and if it's not causing any overload on worker 2,
it may just stay there and worker 3
might be ready to host other tasks when they
arrive in future. In a nutshell, if one of the
nodes go down, the other nodes can handle its load.
If the master goes down, though, the workers
perform a mutual election, where one of the
workers gets promoted and the cluster starts
working again. The next question would be how many
nodes can go down without affecting Swarm?
Well, to make sure that the Swarm cluster functions
properly, at least more than half of the nodes should be working.
Minimum number of required working nodes
for a happy Swarm cluster is equal
to the number of total nodes divided by 2 plus 1,
which again, means more than half.
[No Audio]