EBS vs WAL-E snapshots for PostgreSQL on EC2

I am ready to move our posgresql databases to EC2, but I am a bit unclear about the best backup and restore strategy. The initial plan was to create an EBS-enabled server, configure WAL-E to handle WAL archives and basic backups on S3. I would take snapshots of the final volume of the production server that would be used if the instance crashed. I also see that many people take frequent EBS snapshots for recovery purposes.

What is the recommended strategy? Is there a reason for archiving from WAL and taking scheduled EBS snapshots?

+6
source share
2 answers

EBS snapshots provide you with a slightly different type of backup than WAL-E backups. EBS backs up all disks, which means that if your EC2 Virt goes down, you can just restart virt with the last EBS snapshot and everything will fire right where you take your snapshots at the last moment.

The frequency of your EBS snapshots will determine how good your database backups are.

The attractive thing about WAL-E is "continuous archiving." If I needed every database transaction, then the correct WAL-E choice seems to be the right one. Many applications that I can imagine cannot afford to lose transactions, so this seems like a very smart choice.

I think your plan to take a snapshot of production as a baseline, and then use WAL-E for continuous database archiving, seems very reasonable. Personally, I will most likely add a periodic snapshot (once a day?) To this plan just to make a heavy baseline and make the recovery process a little easier.

The usual caveat: "Check your recovery plans!" applied here. You mix a number of technologies (EC2, EBS, Postgres, Snapshots, S3, WAL-E), so making sure you can really restore - and not just back - is crucial.

+4
source

EBS snapshots save the image of the entire drive, so you can back up all drives on the server and restore them in general in case of data loss or failure. In addition, the EBS block-level snapshot property allows instant recovery; you can restore a 1 TB database and start it in a few minutes. To restore a 1 TB database from scratch using a file-based solution (for example, WAL-E), you will first need to copy data from S3, and the process will take several hours. Using WAL files for recovery is a good approach, as you can return at any time during the transaction, but the snapshot of the entire server will include WAL files, so you still have this option. The backup and quick restore process using EBS snapshots can be automated with scripts or EC2 backup solutions (for example, Backup Solutions for AWS EC2 instances ).

0
source

Source: https://habr.com/ru/post/947264/


All Articles