Approaches to PostgreSQL Replication and Backup
citusdata.com
citusdata.com
EDIT: I should clarify that, like the other HA solutions in the article, of course you need to couple this with a backup solution, like periodic dumps to S3, such as the article suggests.
But thanks for the reply, I've edited to clarify that disk sharing is an alternative to the three HA solutions in the article, not the one backup solution (which in all examples is the mundane "copy to S3").
And gives a little more insight into backup options too: https://www.postgresql.org/docs/10/static/backup.html
If you mis-manage failover, you will destroy your data. This makes proper backup even more important.
Yep, botched failovers are bad. Of course, a botched failover between replicated DBs is no walk in the park either. In many such cases you'll still want to pull backups anyway, if there's no clear way in your domain to merge two "authoritative" databases.
In all cases where you care about your data, you must take backups. There is no substitute for that step.
Additionally, you want to periodically restore your backups and test them for validity — ideally automatically. There's a saying in the ops world, borne of bitter experience:
"Your backups are only as good as their last successful restore."
Ambiguity in online discourse is an ongoing problem. Thanks for helping resolve this occurrence without acrimony.
My understanding was/is that with pg_basebackup the new replica would only need to replay state changes since the last checkpoint, not "the entire state from the primary node—from the beginning of time". What am I missing?
The second option is at the physical block layer. It’s not specific to any one DB but is a bit of a blunt instrument (works everywhere but lacks finesse).
The third option would involve base backups being pushed off site as well as archived WAL logs. The replicas would restore the base backups, then catch up via WAL logs. Finally you can directly link up to the master to have a live standby for read only queries. This is the approach used by the WAL-E and WAL-G backup/restore tools and is the one I generally recommend as it has the most flexibility and resilience.