<div dir="ltr">thank you for sharing Fajar, this is very helpful. A couple questions:<div>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?</div><div>2. related to, if you move lib/lxd, is it safe to snap with lxd running? no consistency issues?</div><div>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?</div><div><br></div><div>thanks,</div><div><br></div><div>Spike</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Apr 27, 2017 at 6:58 PM Fajar A. Nugraha <<a href="mailto:list@fajar.net">list@fajar.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 27, 2017 at 9:09 PM, Spike <span dir="ltr"><<a href="mailto:spike@drba.org" target="_blank">spike@drba.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Tamas,<div><br></div><div>are you actually doing this? any gotchas?</div><div><br></div><div>I'm trying to set up exactly the same, have a live node and a backup node, both running zfs. I have the same containers, with the same mac, at destination, however I'm unclear that just by copying over the rootfs dataset from zfs it will be enough to make it work.</div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Yes, this is enough. Assuming your container ONLY store data in the default rootfs (i.e. no additional disk/path added manually to the container).</div><div><br></div><div>If you also want to replicate old mac address (as well as custom configs, like physical NIC passthru) , also store the output of "lxc config show container_name > container_backup.lxc".</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Has anybody done this before? I think somebody (maybe Fajar) in the past also mentioned keeping /var/lib/lxd on zfs and replicating that too which makes a lot of sense.</div><div><br></div></div></blockquote><div><br></div><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>FWIW, here's more info about my setup</div><div><br></div><div>(1) relevant part of my sanoid.conf in the container host -> main purpose: hourly snapshot, to be able to rollback easily. sanoid cron runs every hour</div><div>###</div><div><div>[rpool/ROOT/ubuntu]</div><div> use_template = rootfs</div><div> recursive = no</div></div><div><br></div><div><div>[data/lib/lxd]</div><div> use_template = container</div><div><br></div><div>[data/lxd/containers]</div><div> use_template = container</div><div> recursive = yes</div><div> process_children_only = yes</div></div><div><div><br></div><div><div>[template_rootfs]</div><div> hourly = 0</div><div> daily = 7</div><div> monthly = 1</div><div> yearly = 0</div><div> autosnap = yes</div><div> autoprune = yes</div><div><br></div><div>[template_container]</div><div> hourly = 36</div><div> daily = 7</div><div> monthly = 1</div><div> yearly = 0</div><div> autosnap = yes</div><div> autoprune = yes</div></div><div>###<br></div><div></div></div><div><br><br>(2) sync to backup host job -> syncoid, runs daily on the backup host. 'backup-cold' is zfs pool backed by AWS SC1 (cheap, cold HDD with lower throughput) Note that I DON'T replicate the host's rootfs (rpool/ROOT/ubuntu), as I can quickly restore a fresh one from my custom AMI if needed.<br><br>###</div><div><div>echo $(date) syncoid start</div><div>## generic container backup<br></div><div># host list</div><div>for h in container_host1 container_host2 container_hostN ;do</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>echo $(date) processing $h</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>zfs create -p backup-cold/$h/lxd</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>syncoid syncoid@$h:data/lib/lxd backup-cold/$h/lxd/lib</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>syncoid -r syncoid@$h:data/lxd/containers backup-cold/$h/lxd/containers</div><div>done</div><div>echo $(date) syncoid end</div></div><div>###<br><br>(3) relevant part of sanoid.conf in the backup host -> main purpose: prune old snapshots (sent from container host)<br><div><br></div><div>###</div><div>[backup-cold]<br></div><div> use_template = backup</div><div> recursive = yes</div><div> process_children_only = yes</div><div><br></div><div><div>[template_backup]</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>hourly = 0</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>daily = 45</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>monthly = 6</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>yearly = 0</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>autoprune = yes</div><div><span class="m_-5910981030432941061gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>autosnap = no<br></div></div><div>###</div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><br></div><div>-- </div><div>Fajar</div></div></div></div></div>
_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a></blockquote></div>