Hacker News new | ask | show | jobs
by halukakin 1338 days ago
Could someone provide link(s) on how regular snapshots of databases can be taken like this? (Googling didn't help much, maybe I'm googling for the wrong keywords.) For me, backing up the database is a few-hour-long process. Restoring it for a developer again is a few hours process. I read about snapshots before but haven't realized they could be this effective.
4 comments

Because it isn't a backup. They put the database into a quiescent state on disk, take a file system snapshot, let the dbms resume working, and send the snapshot data via rsync.

This requires the cooperation of the dbms software to get the on-disk data quiesced. Then your snapshot has to go fast enough that the dbms doesn't end up with too many spinning plates before you let it start writing normally.

Got it. Thank you!
for mariadb :

0) make sure the the database data volume is on lvm or zfs

in a sql prompt:

  1) BACKUP STAGE START; BACKUP STAGE BLOCK_COMMIT;
  2) \! the shell command to take the snapshot
  3) BACKUP STAGE END;
you can now mount your snapshot, copy it offsite and delete it. The restore procedure is left as an exercise!
Very helpful. Thank you!
can't most COW dilesystems like BTRFS or ZFS take a snapshot at a point in time instantly?
It’s the lack of clarity on how they manage access control for what should be regulated data that surprises me, more than the technology achievement.
Article says data is anonymized before dev use. Pretty standard practice.