PostgreSQL

Version as of 01:45, 29 Apr 2024

to this version.

Return to Version archive.

View current version

PostgreSQL Server Backup

When the Zmanda Client for Windows is configured and licensed for PostgreSQL backup, the ZMC allows you to select a PostgreSQL server to back up. When a PostgreSQL server is backed up, all databases are included in the backup, which can be either full (using pg_dump) or incremental (which depends on Posgres write-ahead logs, referred to as WALs).

Requirements for PostgreSQL Server Backup and Restore

These instructions assume you have already installed and licensed the Amanda Enterprise server and the PostgreSQL server being backed up. There are a number of additional requirements:

  • The amanda-client.conf file on the server must be manually edited to include the following lines:

property "PG-DATADIR" "Path_to_PSQL_Data_Dir"
property "PG-ARCHIVEDIR" "Path_to_PSQL_Archive_Dir"
property "PG-HOST" "localhost_or_directory_of_socket_file"
property "PG-TMP" "Path_to_temp_dir"
property "PSQL-PATH" "Path_to_PSQL_Binary"
property "PG-USER"
"PostgreSQL_username"
property "PG-PASSFILE" "Path_to_PSQL_Password_File"
property "PG-PASSWORD" "PSQL_Password"

Path_to_PSQL_Data_Dir

The path to the PostgreSQL data directory.

Path_to_PSQL_Archive_Dir

The path to the PostgreSQL archive directory.  Specify the path where the archive command copies files and stores them between full backup runs. This directory must be writeable by the user that runs PostgreSQL processes.

localhost_or_directory_of_socket_file

Specify localhost or the path to a socket file. Entries beginning with / are interpreted as a socket file path (just specify the path, for example, /tmp, not /tmp/.s.PGSQL.5432. If a directory is used, the PostgreSQL server and Amanda backup server must reside on the same machine.

Path_to_temp_dir

Temporary directory. Must have enough capacity to temporarily store the backup data for a full backup of the PostgreSQL server. Defaults to /tmp.

Path_to_PSQL_Binary

The path to the PostgreSQL psql binary executable file.

PostgreSQL_username

The OS user that runs PostgreSQL processes. Must have write permissions on all of the directories specified by the other properties.

Path_to_PSQL_Password_File

Passfile to use for Postgre 8.1 or greater. See http://www.postgresql.org/docs/8.1/static/libpq-pgpass.html

 

PSQL_Password

The PostgreSQL password (deprecated in PostgreSQL 8.1).

For further details on application properties, see amanda-client.conf(5). For specific details on PostgreSQL agent properties, see ampgsql(8).

Configuring PostgreSQL Server Backups from the ZMC Backup What Page

Create a dedicated backup set for each PostreSQL server you intend to back up. On the Backup What page you are prompted to select what type of object you want to back up. Choose PostgreSQL, and the following options are displayed:

backup_where_postgreSQL.png

Host Name
The name of the machine running the PostgreSQL server you intend to back up.
Data Directory
The path to the PostgreSQL data directory.
Encryption and Compression
Set these options as desired. They are described in more detail here
Advanced Options - Estimate 
If estimates are taking too long and the databases being backed up do not change in size that much from backup to backup, use the the Historical Average calculated from previous backups. In most cases, the default of Reliably Accurate is appropriate.

After you have set the options, click the Add button to add the PostgreSQL server to the backup set. Click Apply Plan to Server to commit the changes; you can then configure the backup set just as you would any other by setting the options on Backup Where, Backup How, and Backup When, etc.

Configuring PostgreSQL Server Restores from the ZMC Restore What Page

Make sure that PostgreSQL is installed in the same location as when the backup was run. The databases and logs file locations should also match the original configuration. When you have selected the disk list entry that includes the Postgres server for restore, the Restore What page displays the following options: 

[insert screenshot]

Select all the appropriate options and Restore->What page.

Troubleshooting

[Need troubleshooting steps]

Troubleshooting Restores