How to do (optionally live) migration of container to the different node?
The case - multiple Ubuntu 18.04/20.04 LTS servers, latest LXD from snap, routed network with public IPs on all containers. I need to migrate container from one server to another with a minimal downtime or (via CRIU) with no downtime and saving all states including network if it’s possible.
vzmigrate from OpenVZ has this algorithms:
copy/sync files while container is running
stop (or suspend) container
sync changed delta files (and RAM, kernel and network state via CRIU in case of “live” migration)
run/resume container
container is running on the new node (all network connections are not broken if CRIU was used)
optional removing files from old node in background
Thanks for this link, I did not know about this options, but what about all other steps?
I was able to find lxd copy/move command with option target, but official documentation looks not enough… Can I do not delete files from unsuccessful/aborted transfers? Will network state be transferred like memory and running processes? How to achieve small downtime without CRIU (something like “copy while running, stop CT, copy delta”) ?
You can delete containers after (failed) transfers. This depends on whether it is at the end or the beginning of the migration. But you can easily find out for yourself. I never had any problems with not being able to delete containers via lxd commands