There are quite a few other tools we could use to persist state. Most of them fall into one of the groups we explored. Among different approaches we can take, the three most commonly taken are as follows:
- Do not persist the state.
- Persist the state on the host.
- Persist the state somewhere outside the cluster.
There’s no reason to debate why persisting data from stateful services is critical, so the first option is automatically discarded.
Since we are operating a cluster, we cannot rely on any given host to be always available. It might fail at any given moment. Even if a node does not fail, sooner or later a service will, and Swarm will reschedule it. When that happens, there is no guarantee that Swarm will run a new replica on the same host. Even if, against all odds, the node never fails, and the service is unbreakable, the first time we execute an...