HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Backing entire Postgres database server up with pg_basebackup

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresentirewithbackingdatabasepg_basebackupserver

Problem

I back Postgres DB 9.1 up using following command:

pg_basebackup -h 127.0.0.1 -U replicationuser -D /storage/test_backup -Ft -z -P


In postgresql.conf I have this set:

wal_level = hot_standby


However, at the end of pg_basebackup run I get this warning:


NOTICE: WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete the backup

I care about the backup of data from time of starting pg_basebackup only (I can afford a bit of downtime in the night, so I shut down the app server that is using this PG instance as backend DB and then start the backup). I do not need nor aim to have "continuous backup".

Question: do I really have to copy the WAL to have complete backup from the time of starting pg_basebackup command? Or is that warning designed strictly for purpose of achieving "continuous archive" functionality?

Solution

Question: do I really have to copy the WAL to have complete backup from the time of starting pg_basebackup command?

Yes, you do.

The DB needs current WAL to start up from the base backup.

You can use pg_basebackup -X stream on 9.3 and above to copy all the required WAL along with the initial basebackup.

Context

StackExchange Database Administrators Q#76650, answer score: 10

Revisions (0)

No revisions yet.