8 ms·
Introducing WAL-G: Faster Disaster Recovery for Postgres
- mephitix 9y agoFantastic intern project, and fantastic work by the intern!
- kafkes 9y agoHello everyone, I'm the primary author for WAL-G and would be happy to answer any questions.
- whitepoplar 9y agoThanks for making this! To someone who's unfamiliar with Postgres tooling, what's the difference between WAL-G and Barman? What're the advantages of using one over the other?
- fdr 9y agoI was kafkes's guide on this project, and the WAL-E author and maintainer... I'd say the differences between WAL-G and Barman are similar to WAL-E and Barman, which comes up relatively frequently. https://news.ycombinator.com/item?id=13573481 https://news.ycombinator.com/item?id=13573481 In summary, WAL-E is simpler program all around that focuses on cloud storage, barman does more around inventories of backups and file-based backups and configuring Postgres. There are integrative downsides to its span. WAL-E also happens to predate Barman.
- ibotty 9y agoWAL-G (and WAL-E) are expected to run next to the main database, while barman is to be run on a separate machine. Barman can also backup many databases. It is essentially the difference between a central backup service and local backups.
- sehrope 9y agoWhat's the min version of the Postgres server this can be used with?
- bgentry 9y agoSeriously awesome work on this! I was expecting some solid improvement when I heard you were rewriting this in Go, but this is beyond what I could have expected. 7x improvement on high end instance types! Also, what an impressive project to have on the resume as a college intern. I don't think many interns get to tackle something so meaningful.
- andrewstuart2 9y agoNor would many choose to, given the opportunity. Way to pick an interesting and challenging project! :-)
- ocharles 9y agoCan you elaborate on how much automated testing is behind this? When it comes to backup tools, I am very cautious.
- kafkes 9y agoWAL-G has a number of unit tests, and has been tested manually in a staging environment for a number of weeks without issues. We are looking to implement more integration tests in the future.
- bluetech 9y agoIt would be nice if you could sign the tarball with the binary. I see the tag is already signed so hopefully it's not much trouble: https://wiki.debian.org/Creating%20signed%20GitHub%20releases https://wiki.debian.org/Creating%20signed%20GitHub%20release...
- kafkes 9y agoDone.
- patrick_vbn 9y agoAny plans to support backup to Google Cloud Storage instead of just S3?
- timdorr 9y agoOr some sort of pluggable storage system. For now, since I'm also on GCP, I'm using PGHoard: https://github.com/ohmu/pghoard https://github.com/ohmu/pghoard
- fdr 9y agoUnknown, but I don't have an immediate plan to implement them: https://news.ycombinator.com/item?id=15049527 https://news.ycombinator.com/item?id=15049527
- ngrilly 9y agoThanks! Does WAL-G provides some kind of "continuous backup" where changes committed to the database are continuously streamed to the backup storage? Or does it work "step by step", for example by backing up every 5 minutes or every 10 MB?
- andruby 9y agoIt does continuous backup like WAL-E. Both back up PG's WAL files (Write Ahead Log) and allow restoring your database state as it was at a specific time or after a specific transaction committed. This is known as point-in-time recovery (PITR) [0] Users and admins make mistakes, and accidentally delete or overwrite data. With PITR you can restore in a new environment, just before the mistake occurred and recover the data from there. [0] https://www.postgresql.org/docs/9.6/static/continuous-archiving.html https://www.postgresql.org/docs/9.6/static/continuous-archiv...
- ngrilly 9y agoWhat I meant is that the archive_command is run only when a WAL segment is completed or when archive_timeout is reached. In the meantime, nothing is backed up. On a low traffic database, this can be a problem. I'm wondering if there is a way to continuously stream the WAL to an object storage like S3, without waiting to have a complete segment.
- daurnimator 9y agoS3 is a block store; not something you can really stream to. However it might be interesting to stream WAL logs to e.g. AWS Kinesis....
- brianwawok 9y agoIs this production ready, or just an early dev snapshot?
- kafkes 9y agoWAL-G is not yet production ready, but it has been used in a staging environment for the past few weeks without any issues. Once fdr adds parallel WAL support, he plans to take it into production.
- brianwawok 9y agoCool cool. is google cloud storage on the roadmap?
- fdr 9y agoI answered this question in a couple of other places, but: unknown because I don't have use for that yet. https://news.ycombinator.com/item?id=15049527 https://news.ycombinator.com/item?id=15049527
- justinclift 9y agoWAL-G looks like it should be able to talk to Minio (minio.io, S3 compatible thing, also written in go) as a backend instead of S3 itself. Minio has an interesting feature where it can be a "gateway" to other cloud storage. Google Cloud Storage is one of their specific examples: https://docs.minio.io/docs/minio-gateway-for-gcs https://docs.minio.io/docs/minio-gateway-for-gcs So WAL-G would talk to Minio, and Minio would transparently proxy that to GCS.
- brianwawok 9y agoNeat. My concern out of the gate is what would be the perf hit. I assume I am switching from WAL-E to WAL-G for more perf. But WAL-E speaks GCS. If WAL-G needs an extra hop to do so, may lose some of the point of it..
- trojanowski 9y agoDo you have plans to support encrypted backups?
- fdr 9y agoMaybe. Depends what you mean by that: https://news.ycombinator.com/item?id=15049691 https://news.ycombinator.com/item?id=15049691
- sehrope 9y agoI've used WAL-E (the predecessor of this) for backing up Postgres's DB for years and it's been a very pleasant experience. From what I've read so far this looks like it's superior in every way. Lower resource usage, faster operation, and the switch to Go for WAL-G (v.s. Python for WAL-E) means no more mucking with Python versions either. Great job to everybody that's working on this. I'm looking forward to trying it out.
- tyingq 9y agoEvery time I saw that mentioned, my mind goes to the movie. https://g.co/kgs/d8G9u5 https://g.co/kgs/d8G9u5
- ocharles 9y agoI don't think it's a coincidence WAL-E is named as it is :)
- mylons 9y agopython versioning can be a bitch, but virtualenv/virtualenvwrapper make 99.999999% of the problems go away. i have a huge ETL pipeline at twitch that relies heavily on wal-e, and installs it on worker nodes and things like that. that being said, if WAL-G is faster, i don't care waht it is written in, and am happy to use it
- craigkerstiens 9y agoFor those interested in the repo directly to give it a try you can find it here: https://github.com/wal-g/wal-g https://github.com/wal-g/wal-g
- upbeatlinux 9y agoWow, great work! I am definitely going to test this out over the weekend. However AFAICT the `aws.Config` approach breaks certain backwards compatibility w/how wal-e handles credentials. Also wal-g does not currently support encryption. FWIW, I would love to simply drop-in wal-g without having to make any configuration changes.
- fdr 9y agoDo you want GPG based or some other client side encryption, or S3's encryption support? The latter could probably just be turned on. The former is a feature requiring code.
- upbeatlinux 9y agoIdeally the presence of the `WALE_GPG_KEY_ID` env var should enable encrypted backups https://github.com/wal-e/wal-e#encryption https://github.com/wal-e/wal-e#encryption. Put differently to be a "successor" it needs to be a drop in replacement ;)
- fdr 9y agoI have to be selective about maintenance of features. I'll consider GPG support.
- tatersolid 9y agoPlease consider libsodium or a similar "modern" crypto library instead. There's a lot of ugly 90s crypto in GPG and the API is terrible. Libsodium makes it hard for non-crypto devs to shoot themselves in the foot, and is much less code to write.
- trojanowski 9y agoAlternatively you could use a combination of AES and RSA similar how pghoard implements it: https://github.com/ohmu/pghoard https://github.com/ohmu/pghoard The RSA keys (or path to them) would be passed as environment variables. It would be a little easier to setup than gpg (especially for automatic backup restoration).
- drob 9y agoThis is great. Can't wait to be using it. We've been using WAL-E for years and this looks like a big improvement. The steady, high throughput is a big deal – our prod base backups take 36 hours to restore, so if the recovery speed improvements are as advertised, that's a big win. In the kind of situation in which we'd be using these, the difference between 9 hours and 36 hours is major. Also, the quality of life improvements are great. Despite deploying WAL-E for years, we _still_ have problems with python, pip, dependencies, etc, so the switch to go is a welcome one. The backup_label issue has bitten us a half dozen times, and every time it's very scary for whoever is on-call. (The right thing to do is to rm a file in the database's main folder, so it's appropriately terrifying.) So switching to the new non-exclusive backups will also be great. We're on 9.5 at the moment but will be upgrading to 10 after it comes out. Looking forward to testing this out. Awesome work!
- humanfromearth 9y agoSame here, perf is obviously great, but no more crazy dependencies is just great! So much time I wasted trying to make it fit into a docker container.
- gardnr 9y agoCan you share your dockerfiles?
- ozgune 9y agoHey Dan, nice to hear from you! > our prod base backups take 36 hours to restore, so if the recovery speed improvements are as advertised, that's a big win. Yes, if you attach 16TB of storage to each instance, your back-up restores may take a while. :))
- paulsutter 9y agoIs it possible to run a continuous restore in parallel with normal operation so that there's a warm standby (almost) ready to go? Especially in another data center?
- jarym 9y ago"WAL-E compresses using lzop as a separate process, as well as the command cat to prevent disk I/O from blocking." Good to see people sticking to the unix philosophy of doing one thing well and delegating other concerns - cat and lzop are both fine choices!
- wmf 9y agoI don't know if you're being sarcastic, because the point of the article is that the Unix philosophy was a performance bottleneck and they replaced all the Unixy stuff with Go libraries.
- jarym 9y agoI wasn't being sarcastic - I like the fact that they replaced what needed replacing and kept what worked well.
- jfkw 9y agoWill WAL-G eventually support the same archive targets as WAL-E (S3 and work-alikes, Azure Blob Store, Google Storage, Swift, File System)?
- fdr 9y agoAs I'm probably the steward on this going forward: unknown. I don't intend to implement them unless I need them. Would I take a patch with good coverage that implemented those.
- boulos 9y agoWould you be willing to own the abstraction for multiple backends? The code is currently only a bit hardcoded to S3/AWS, but I assume most of the "work" will be discussing how to abstract different transports, exponential backoff, resumable uploads, and so on. Fwiw, the GCS client for go (import "cloud.google.com/go/storage") is very straightforward. Though as others have pointed out, it might be worthwhile to just try to use minio-go if you want to gain Ceph as well. Disclosure: I work on Google Cloud (and if the way is paved, we will contribute here; seems like a great project)
- gigatexal 9y agoI wonder where python will end up in the next five or so years if Go is continually chosen for concurrent or high perf code things like this.
- X86BSD 9y agoWhy would this be a better option than a simple zfs snapshot, zfs send/recv backup and recovery strategy?