![]() It can be a simple one-liner, as in the example above, it can be a call to a complex script or binary. This command will be used to copy the files to their destination. PostgreSQL doesn’t care where you will put the files, as long as you’ll tell it how to do it. Archive_command requires more explanation. The settings above have to be configured – you want to enable archiving (archive_mode = on), you want also to set wal_lever to archive. Wal_level = archive # minimal, replica, or logical archive_mode = on # enables archiving off, on, or alwaysĪrchive_command = 'test ! -f /wal_archive/%f & cp %p /wal_archive/%f' # command to use to archive a logfile segment Once this is done, we can start editing the PostgreSQL configuration. We’ll create a simple directory and make sure it’s owned by ‘postgres’ user. This can be in any location: on disk, on NFS mount, anywhere – as long as PostgreSQL can write to it, it’ll do. We’ll start with creating a directory in which the WAL files will be stored. First of all, we need to setup WAL archiving. These files can be used for replication, but they can also be used for PITR. PostgreSQL stores all modifications in form of Write-Ahead Logs (WAL). Let’s see how the whole process of backing up data and restoring it after an incident may look like on PostgreSQL 10.1 (which you can deploy using ClusterControl). Therefore you need to think about how you can recover all the changes that happened since you took the last backup. In general, it’s not really ok to lose so much data. So restoring from the last backup means losing a day’s worth of data. If you take backups on a daily basis, in the worst case scenario, you will have almost 24 hours of data that is not in more than you had in your last backup. You need to keep in mind that the backup is a “snapshot” of your dataset at a given point of time. Point-in-time recovery (PITR) is a pretty useful feature. In this blog post, we’ll look at how to do point-in-time recovery for PostgreSQL. In a previous post, we discussed Postgres backups in general. ![]() ![]() ![]() The ability to perform backup and restore of your data is one of the fundamental requirements of any DBMS. ![]()
0 Comments
Leave a Reply. |