Re: syncing bhyve instances

2018-01-23 Thread Michael Gmelin


> On 22. Jan 2018, at 20:47, tech-lists  wrote:
> 
>> On 22/01/2018 16:38, Paul Vixie wrote:
>> for live sync you'll have to run software inside the guest that knows
>> how to properly freeze state. for example if there's a live database of
>> any kind you'll want it to be in its quiet state before you sync from
>> it. in those situations, i do use rsync.
> 
> Yeah, thought it might be this. Sorry I wasn't more clear initially
> about the use case.
> 
> Basically, the production server is in a datacentre and the reserve
> server is on a very fast vdsl service. The reason for the reserve server
> is, if the production server fails then I swap DNS to point at the
> reserved server and the guests on it without interruption of service.
> All guests are running databases (mysql) though they aren't especially
> busy. So I guess the best bet would be mysql replication for the
> databases and rsync for everything except mysql?
> 
> thanks everyone who took the time to answer

For the database, mysql replication is the way to go (otherwise you would need 
to stop/lock the server every time you do a snapshot and you'll get 
near-realtime replication which will always be more current than your 
snapshots). For  the system I'd suggest to create automation for the setup, so 
you can apply changes to both systems without a need to sync/clone/copy from 
one to the other. For anything else left (data files on disk, non-system, 
non-package, non-config) use regular rsync (or zfs send if your setup permits - 
I'd stick with rsync).

Yours,
Michael

p.s. Make sure to include monitoring (especially replication latency and data 
integrity)


> 
> -- 
> J.
> ___
> freebsd-virtualization@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to 
> "freebsd-virtualization-unsubscr...@freebsd.org"

___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: syncing bhyve instances

2018-01-22 Thread Miroslav Lachman

tech-lists wrote on 2018/01/22 20:47:

On 22/01/2018 16:38, Paul Vixie wrote:

for live sync you'll have to run software inside the guest that knows
how to properly freeze state. for example if there's a live database of
any kind you'll want it to be in its quiet state before you sync from
it. in those situations, i do use rsync.


Yeah, thought it might be this. Sorry I wasn't more clear initially
about the use case.

Basically, the production server is in a datacentre and the reserve
server is on a very fast vdsl service. The reason for the reserve server
is, if the production server fails then I swap DNS to point at the
reserved server and the guests on it without interruption of service.
All guests are running databases (mysql) though they aren't especially
busy. So I guess the best bet would be mysql replication for the
databases and rsync for everything except mysql?


Forget about uninterrupted services. Even if you have very short times 
on DNS you will have downtime in minutes until old DNS entries expired.
If you need "almost real-time replication" then you definitely need both 
ends online and do MySQL replication (with all its own problems). And 
some kind of rsync synchronisation as you said.


Miroslav Lachman
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: syncing bhyve instances

2018-01-22 Thread tech-lists
On 22/01/2018 16:38, Paul Vixie wrote:
> for live sync you'll have to run software inside the guest that knows
> how to properly freeze state. for example if there's a live database of
> any kind you'll want it to be in its quiet state before you sync from
> it. in those situations, i do use rsync.

Yeah, thought it might be this. Sorry I wasn't more clear initially
about the use case.

Basically, the production server is in a datacentre and the reserve
server is on a very fast vdsl service. The reason for the reserve server
is, if the production server fails then I swap DNS to point at the
reserved server and the guests on it without interruption of service.
All guests are running databases (mysql) though they aren't especially
busy. So I guess the best bet would be mysql replication for the
databases and rsync for everything except mysql?

thanks everyone who took the time to answer

-- 
J.
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: syncing bhyve instances

2018-01-22 Thread Paul Vixie
i've used zfs for this, but i have to shut the guest down to do it. i'm 
using zvols for my guest system disks, so it's


shut the guest down (maybe just to single-user mode)
make a zfs checkpoint
start the guest back up
zfs send the checkpoint

this also assumes that the sync-destination is a cold spare, sitting in 
its shutdown state until needed.


for live sync you'll have to run software inside the guest that knows 
how to properly freeze state. for example if there's a live database of 
any kind you'll want it to be in its quiet state before you sync from 
it. in those situations, i do use rsync.


bhyve could conceivably offer a feature to export the guest RAM, and 
with a little page-stealing, this could be made into an incremental sync 
feed. but i predict it would be enormous in size for any non-trivial guest.

___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: syncing bhyve instances

2018-01-22 Thread Miroslav Lachman

tech-lists wrote on 2018/01/22 16:45:

Hello lists,

If I have two bhyve hosts, production [p] and reserve [r], and on both
there are identical guest[s] [1] and [2], what is the best way to sync
the guests? What's the best tool?

1. would syncing the guests from the host work? (in other words, running
some kind of tool like say rsync on the host work?). What about the
internal state of the guest? Could rsync account for changes in its
internal state?

2. or would it be better to run a tool like rsync inside each guest?

3. is there a better tool for this than rsync?


It is too vague question. But if you just want poor mans replication I 
would go with ZFS (send + receive) from host p to r in few minutes 
intervals.
Of course it will not help you with internal states of running VMs. It 
will just sync filesystems in better way than rsync. (if you have ZFS)


Miroslav Lachman
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"