最後更新: 2020-08-22
介紹
CRIU - implement checkpoint/restore functionality for Linux in userspace.
Hompage: http://criu.org/Main_Page
Migrate Script
migrate-lxc.sh
#!/bin/bash name=proxy host=n.n.n.n ######## Code ######## CheckPoint_Dir=/lxc/checkpoint LXCPATH=/lxc do_rsync() { rsync -rltzh --progress --devices --rsync-path="sudo rsync" $1 $host:$1 } lxc-checkpoint -n $name -D $CheckPoint_Dir -s -v do_rsync $LXCPATH/$name do_rsync $CheckPoint_Dir ssh $host "sudo lxc-checkpoint -r -n $name -D $CheckPoint_Dir -v" ssh $host "sudo lxc-wait -n $name -s RUNNING"
Opts
# The directory to dump the checkpoint metadata.
-D PATH, --checkpoint-dir=PATH
# Optionally stop the container after dumping.
-s, --stop
# Restore the checkpoint for the container, instead of dumping it.
-r, --restore