[lxc-users] LXD move, how to reduce downtime without live migration

Fajar A. Nugraha list at fajar.net
Sat Apr 29 22:00:20 UTC 2017


On Sun, Apr 30, 2017 at 3:15 AM, Spike <spike at drba.org> wrote:

> thank you for sharing Fajar, this is very helpful. A couple questions:
> 1. how do you ensure data consistency? I don't think it's safe to take a
> snap of a mysql container with mysql running for example. Other backup
> solutions I've used in the past, like bacula for example, allowed you to
> run pre-backup jobs to say make the db readonly or stuff like that. Are you
> doing such a thing with sanoid?
>

This question would be more appropriate for zfs list.

Short version: zfs ensures point-in-time disk-snapshot consistency.
Restoring to that snapshot (or using it for send/receive) would be similar
(from application point of view) to 'recovering from a crash/power
failure'. Most modern applications (including any database/filesystem which
has journaling or atomic guarantee) can recover from that.



> 2. related to, if you move lib/lxd, is it safe to snap with lxd running?
> no consistency issues?
>

The most important part of /var/lib/lxd is the sqlite db. It's seldom
modified (e.g. on container creation). Plus sqlite has journaling.



> 3. if you move lxd which, and maybe I'm wrong, means you're also
> replicating all container's configs, how are you testing your backup since
> you would not be able to spin up the container without causing a conflict?
>
>
Some of my containers are self-contained in the host. For example:

- a web app and db both has static private IP on lxbdr0 network (e.g.
10.0.3.201 and 10.0.3.202)
- the web container access db container using hostname defined in /etc/hosts
- the host create iptables DNAT (using ufw, see another thread) to allow
access to http, https, and ssh to the web container.

In that case, I can safely duplicate the web & db container to another host
without causing conflict (i.e. no need to worry about 'dev' web container
messing up data on 'production' db container). Clients can choose which
host to access (e.g. 'production' or 'dev') using host IP address, or a
hostname defined statically on client's /etc/hosts/

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170430/930fec15/attachment.html>


More information about the lxc-users mailing list