Stop services during backup when using snapshots?
https://lemmy.ca/post/26151124
=> More informations about this toot | More toots from avidamoeba@lemmy.ca
Stop the whole VM during snapshots.
=> More informations about this toot | More toots from solrize@lemmy.world
Not a VM. Consider the service just a service running on the host OS.
=> More informations about this toot | More toots from avidamoeba@lemmy.ca
This is one of the reasons Docker exists.
=> More informations about this toot | More toots from null@slrpnk.net
And I’m using Docker, but Docker isn’t helping with the stopping/running conundrum.
=> More informations about this toot | More toots from avidamoeba@lemmy.ca
Why not?
=> More informations about this toot | More toots from null@slrpnk.net
Docker doesn’t change the relationship between a running process and its data. At the end of the day you have a process running in memory that opens, reads, writes and closes files that reside on some filesystem. What happens with the files when the process is killed instantly and what happens when it’s started afterwards and it re-reads the files doesn’t change based on where the files reside or where the process runs. You could run it in docker, in a VM, on Linux, on Unix, or Windows. You could store the files in a docker volume, you could mount them in, have them on NFS, in the end they’re available to the process via filesystem calls. In the end the effects are limited to the interactions between the process and its data.
=> More informations about this toot | More toots from avidamoeba@lemmy.ca
docker stop container
Make your snapshot
docker start container
What am I missing?
=> More informations about this toot | More toots from null@slrpnk.net
That’s the trivial scenario that we know won’t fail - stopping the service during snapshot. The scenario that I was asking people’s opinions on is not stopping the service during snapshot and what restoring from such backup would mean.
Let me contrast the two by completing your example:
Now here’s the interesting scenario:
Notice that in the second scenario we are not stopping the container. The snapshot is taken while it’s live. This means databases and other files are open, likely actively being written to. Some files are likely only partially written. There are also likely various temporary lock files present. All of that is stored in the snapshot. When we restore from this snapshot and start the service it will see all of that. Contrast this with the trivial scenario when the service is stopped. Upon stopping it, all data is synced to disk, inflight database operations are completed or canceled, partial writes are completed or discarded, lock files are cleaned up. When we restore from such a snapshot and start the service, it will “think” it just starts from a clean stop, nothing extra to do. In the live snapshot scenario the service will have to do cleanup. For example it will have to decide what to do with existing lock files. Are they there because there’s another instance of the service is running and writing to the database or did someone kill its process before it has the chance to go through its shutdown cleanup. In one case it might have to log an error and quit. In the other it would have to remove the lock files. And so on and so forth.
=> More informations about this toot | More toots from avidamoeba@lemmy.ca
Oh I see – you’re asking a hypothetical.
The simple answer is that it’s a bad idea to take snapshots of running databases because at best they could be missing info and at worst they can corrupt.
The short answer: Don’t.
=> More informations about this toot | More toots from null@slrpnk.net
text/gemini
This content has been proxied by September (ba2dc).