官术网_书友最值得收藏!

Failover

Fortunately, failover strategies are part of Docker Swarm. Remember, when we execute a service command, we are not telling Swarm what to do but the state we desire. In turn, Swarm will do its best to maintain the specified state no matter what happens.

To test a failure scenario, we'll destroy one of the nodes:

docker-machine rm -f node-3

Swarm needs a bit of time until it detects that the node is down. Once it does, it will reschedule containers. We can monitor the situation through service ps command:

docker service ps go-demo

The output (after rescheduling) is as follows (ID is removed for brevity):

As you can see, after a short period, Swarm rescheduled containers among healthy nodes (node-1 and node-2) and changed the state of those that were running on the failed node to Shutdown. If your output still shows that some instances are running on the node-3, please wait for a few moments and repeat the service ps command.

主站蜘蛛池模板: 益阳市| 南平市| 静宁县| 林周县| 肥乡县| 枣强县| 镇巴县| 嵊州市| 友谊县| 应用必备| 金平| 和田市| 屏南县| 武乡县| 绥宁县| 珠海市| 永州市| 义马市| 晋州市| 开平市| 临泽县| 闽清县| 南郑县| 芷江| 田阳县| 沂南县| 乌兰浩特市| 屏东县| 太仓市| 喜德县| 贡山| 扎鲁特旗| 莱州市| 醴陵市| 新龙县| 比如县| 密云县| 大关县| 蒙山县| 灵山县| 庐江县|