Changes

Jump to navigation Jump to search
57 bytes added ,  17:03, 14 March 2013
reformatted
Line 1: Line 1:  
The <code>crtools</code> utility can be used to perform live migration of apps or containers. This page is a sort of HOWTO describing this.
 
The <code>crtools</code> utility can be used to perform live migration of apps or containers. This page is a sort of HOWTO describing this.
 +
 +
== Migration sequence ==
    
In order to live-migrate an application or a container you should make sure, that files, that are/can be accessed by processes you're migrating are available on both nodes -- source and destination. This can be achieved by using either shared file-system such as NFS, GlusterFS or CEPH, or by using <code>rsync</code> to copy files from one box to another. Further in this article we assume, that the file-system is the same on both sides.
 
In order to live-migrate an application or a container you should make sure, that files, that are/can be accessed by processes you're migrating are available on both nodes -- source and destination. This can be achieved by using either shared file-system such as NFS, GlusterFS or CEPH, or by using <code>rsync</code> to copy files from one box to another. Further in this article we assume, that the file-system is the same on both sides.
   −
So, in order to live migrate tasks you should do these steps:
+
In order to live migrate tasks you should do these steps:
 +
 
 +
=== Dump ===
 +
Take tasks you're about to migrate and dump them into some place, asking <code>crtools</code> to leave them in stopped state after dump:
 +
 
 +
[src]# crtools dump --tree <pid> --images-dir <path-to-existing-directory> --leave-stopped
 +
 
 +
The directory you put images to can reside on the shared file-system if you're using one. In this case you can skip the Copy step and proceed to Restore.
 +
 
 +
=== Copy ===
 +
Copy images to destination node:
   −
;step 1
+
[src]# scp -r <path-to-images-dir> <dst-node>/<path-to-images>
: Take tasks you're about to migrate and dump them into some place, asking <code>crtools</code> to leave them in stopped state after dump:
  −
<pre>
  −
# crtools dump --tree <pid> --images-dir <path-to-existing-directory> --leave-stopped
  −
</pre>
  −
The directory you put images to can reside on the shared file-system if you're using one. In this case you can proceed to step 3.
     −
;step 2
+
=== Restore ===
: Copy images to destination node
+
Go to the destination node and restore the apps from images on it:
<pre>
  −
# scp -r <path-to-images-dir> <dst-node>/<path-to-images>
  −
</pre>
     −
;step 3
+
[dst]# crtools restore --tree <pid> --images-dir <path-to-images>
: Go to the destination node and restore the apps from images on it
  −
<pre>
  −
# crtools restore --tree <pid> --images-dir <path-to-images>
  −
</pre>
     −
; step 4
+
=== Kill ===
: If everything went OK you can return on the source node and kill stopped tasks on it.
+
If everything went OK you can return on the source node and kill stopped tasks on it.
    +
== Notes ==
    
The directories with images would contain two copies of applications memory, which may be space-consuming. The CRIU can perform [[disk-less migration]] to address this.
 
The directories with images would contain two copies of applications memory, which may be space-consuming. The CRIU can perform [[disk-less migration]] to address this.

Navigation menu