Making "backup" of banks Postgresql correctly
Posted by admin on November 30th, 2009

Rather than the more popular "dump", the method below is a better way of doing backup of Postgresql, mainly because it is an online backup (ie, not for the bank). Very useful for large databases.
To do so, enable the WAL (write ahead logging) of Postgresql. Inside the postgresql.conf, there should be the following line:
archive_command = 'cp-i% p / mnt / server / ArchiveDir /% f </ dev / null'
Logically, / mnt / server / ArchiveDir apena is the destination directory of the archive, and should be changed to a mount point on which you have enough space to store logs.
Caution Test command. If the cp-i does not work, you must perform a check in executing the script. Check the documentation for PostgreSQL on the link below.
Then:
Design in Bacula RunBeforeJob one script that runs in console Postgres superuser with the bank:
SELECT pg_start_backup ('label'); Where label is a name you assign to this transaction backup.
The backup will then run Bacula, copying the database files only. Should never be backed up the database file in conjunction with the backup of archived logs (folder "archieve" defined above).
RunAfterJob now - and this is very important to create a script that performs the following routine in the PostgreSQL database:
SELECT pg_stop_backup (); The good soul that makes scripts can post here ... =]
Source: http://www.postgresql.org/docs/8.1/static/backup-online.html
Tip: Flavio Gurgel, professor of Postgresql.
Hugs,
Heitor Faria
























