Incus - Sync two hosts (mirroring)

I want to Mirror two host to have identical containers where if one host crashes, we can start up the containers on the second host. Is there a way to do this and what is it called so I can do some research. I have to apologize in advance as I still a Incus/LXC novice, even though I picked up quite a bit.

I thought about clustering, but it seems this more for workload.

Thank you for any help.

To be able to keep identical containers in two or more places, you need to store the containers on a distributed storage driver. Such a storage driver is Ceph.

If you have a cluster but no distributed storage driver, you would need to somehow sync manually the containers between the hosts.

Hello Trey,

I bieleve such a feature is not ‘inbuilt’ like it could be on some hypervisors :slight_smile:

Tho, Incus is able to do so :

No distributed Storage :

  • you’ll need to make a copy of the instance you wish to duplicate, on the other host (incus copy --help). Once the copy is done, you can append --refresh, to only copy new snapshots, depending on your storage backend. It must be done regularly, to keep track of changes.

  • Second, you’ll have to set something up, that will check either, VM availability, or host availability, and then, start the “backup vm” :slight_smile: (some simple cron job, pinging a vm, and running a local boot command to the backup vm in case of error… and another one, that would stop your backup VM, copy it to the second host, and then run the new “prod” VM…)

Tried such a setup (if you got time, i may be able to dig out this bash script…), but it’s not very stable, and thresholds are not easy to set… :slight_smile:

Shared Storage :

If you plan to run it, for something a little bit “critical”, i’d suggest shared storage.
With Ceph, your VM is located on both hosts, if they are configured as a cluster, you can configure “Cluster Healing Threshold” (in seconds) : when your host is unresponsive for more than X seconds, incus automatically evacuate the host, and run the VMs on the remaining host.

It’s working best with VMs, Containers, are somehow hard to live-migrate :slight_smile:

Hope it helps,

/joen