logoalt Hacker News

martinrameyesterday at 8:38 AM3 repliesview on HN

What about ZFS Snapshots and send/recv for backup and restore?. For us this is the cleanest approach, since we use it not only for PostgreSQL, but for all the data in our organization. Of course, the underlying filesystem must be ZFS.


Replies

hnarnyesterday at 9:31 AM

I guess it all depends on your requirements, since this would still cause data loss for the delta time between failure and your last snapshot, but I'm a huge fan of ZFS, and it might be one reason to try out Postgres on FreeBSD, since the only Linux distro that ships ZFS painlessly out of the box is Ubuntu to my knowledge.

I'm also curious how Distributed Replicated Block Device (DRBD) would perform, it would cause obvious latency but perhaps it would be an easier and more efficient solution for a "hot spare" setup than using Postgres native functionality. To my understanding, DRBD can be configured to protect you from hardware IO errors by "detaching" from an erroring disk.

I also don't know if it's a valid point, but I've heard people say that you don't want a fancy CoW filesystem for databases, since much of the functionality offered are things that databases already solve themselves, so you might be sacrificing performance for safety from things that "should not happen"(tm) anyway, depending on how it's set up I guess.

tudorgyesterday at 12:27 PM

On the Xata platform we actually do CoW snapshots and branching at the block device level, which works great.

However we are developing pgstream in order to bring in data and sync it from other Postgres providers. pgstream can also do anonymisation and in the future subsetting. Basically this means that no matter which Postgres service you are using (RDS, CloudSQL, etc) you can get still use Xata for staging and dev branches.

codefloyesterday at 9:05 AM

Or btrfs. I also think that filesystem snapshots are underrated backup strategy, assuming your data fits on one disk (which should be the case for almost all applications outside of FAANG).

show 1 reply