Restore Swarm¶
Prior to restoring Swarm, verify that you meet the following prerequisites:
The node you select for the restore must use the same IP address as the node from which you made the backup, as the command to force the new cluster does not reset the IP address in the swarm data.
The node you select for the restore must run the same version of Mirantis Container Runtime (MCR) as the node from which you made the backup.
You must have access to the list of manager node IP addresses located in
state.json
inside the zip file.If
auto-lock
was enabled on the backed-up swarm, you must have access to the unlock key.
To perform the Swarm restore:
Caution
You must perform the Swarm restore on only the one manager node in your cluster and the manager node must be the same manager from which you made the backup.
Shut down MCR on the manager node that you have selected for your restore:
systemctl stop docker
On the new swarm, remove the contents of the
/var/lib/docker/swarm
directory. Create this directory if it does not exist.Restore the
/var/lib/docker/swarm
directory with the contents of the backup:tar -xvf <PATH_TO_TARBALL> -C /
Set
<PATH_TO_TARBAL>
to the location path where you saved the tarball during backup. If you are following the procedure in backup-swarm, the tarball will be in a/tmp/
folder with a unique name based on the engine version and timestamp:swarm-${ENGINE}-$(hostname -s)-$(date +%s%z).tgz
.Note
The new node uses the same encryption key for on-disk storage as the old one. It is not possible to change the on-disk storage encryption keys. For a swarm that has auto-lock enabled, the unlock key is the same as on the old swarm and is required to restore the swarm.
Unlock the swarm, if necessary:
docker swarm unlock
Start Docker on the new node:
systemctl start docker
Verify that the state of the swarm is as expected, including application-specific tests or checking the output of
docker service ls
to verify that all expected services are present.If you use auto-lock, rotate the unlock key:
docker swarm unlock-key --rotate
Add the required manager and worker nodes to the new swarm.
Reinstate your previous backup process on the new swarm.
See also
Administer and maintain a swarm of Docker Engines in the Docker documentation