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

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.

主站蜘蛛池模板: 济阳县| 丽江市| 犍为县| 元阳县| 明溪县| 离岛区| 即墨市| 会东县| 沿河| 于都县| 那曲县| 伊吾县| 阿城市| 龙州县| 香格里拉县| 通辽市| 鄂州市| 五指山市| 巴塘县| 平塘县| 重庆市| 姜堰市| 赣州市| 南陵县| 北宁市| 大安市| 雷山县| 白河县| 竹溪县| 乐安县| 繁峙县| 屏边| 安多县| 武冈市| 疏附县| 宜昌市| 佛坪县| 博白县| 长汀县| 门头沟区| 施甸县|