PostgreSQL Backup

You can use Veeam Agent for Linux to create transactionally consistent backups of Veeam Agent machines that run the PostgreSQL database system.

NOTE

You can use Veeam Explorer for PostgreSQL to restore PostgreSQL instances from a Veeam Agent for Linux backup. For information about item-level recovery of PostgreSQL systems, see the Restoring PostgreSQL Items section of the Veeam Backup & Replication User Guide.

Requirements and Limitations for PostgreSQL Processing

  • Veeam Agent supports processing of PostgreSQL database systems version 12 – 17.
  • Veeam Agent does not support backup of PostgreSQL clusters.

Authentication Methods

Veeam Agent for Linux can connect to the PostgreSQL database system using one of the following methods:

  • Database user with password — Veeam Agent uses the PostgreSQL account credentials that you specify in the backup job settings.
  • Database user with password file — Veeam Agent the PostgreSQL database system to use account credentials that are stored in the .pgpass password file. To learn more about password file configuration, see Preparing Password File for PostgreSQL Processing.
  • System user without password — Veeam Agent uses the peer authentication. In the peer authentication method, Veeam Agent for Linux uses the OS account as the PostgreSQL database user name.

How PostgreSQL Processing Works

After Veeam Agent for Linux finishes database system processing, Veeam Agent proceeds to the next step of the backup process. To learn more, see How Backup Works.

To ensure that the backed-up data is in the consistent state, Veeam Agent performs the PostgreSQL database processing using an internal component: pgsqlagent. To process the database system, Veeam Agent performs the following operations:

  1. When the backup job starts, Veeam Agent scans the Veeam Agent computer for PostgreSQL instances.

By default, Veeam Agent recursively scans the /etc/postgresql, /var/lib/postgresql and /var/lib/pgsql directories for the configuration files of PostgreSQL instances. If your instance is stored in a custom location, you must specify its location in the PostgreSQL configuration file — VeeamPostgreSQLAgent.xml. You must create this file in the /etc/veeam/ directory. To explicitly include or exclude specific directories in/from processing, you can use the following elements in the configuration file:

  • AddConfigDirs — use this element to specify paths to directories that you want Veeam Agent to scan.
  • ExcludeConfigDirs — use this element to specify paths to directories that you do not want Veeam Agent to scan.

TIP

You can specify directories that you want to include and directories that you want to exclude in the same configuration file.

An example of the VeeamPostgreSQLAgent.xml file:

<config AddConfigDirs="/opt/psql/" ExcludeConfigDirs="/var/lib/postgresql/13/main45/,/var/lib/postgresql/13/maindd/" />

 

IMPORTANT

The configuration file must be formatted as a single line XML.

  1. If a PostgreSQL instance is detected, Veeam Agent collects information about its state and configuration settings. The following Veeam Agent behavior depends on the collected information:

To learn more about the WAL level setting, see PostgreSQL documentation.

TIP

Veeam Agent stores all collected data about PostgreSQL instances in the .VBM file, which allows Veeam Agent to restore PostgreSQL instance as an application item. To learn more, see Restoring PostgreSQL Items in the Veeam Backup & Replication User Guide.

  1. Veeam Agent creates a snapshot of the volume and proceeds to the next step of the backup process.

To learn more about backup process, see How Backup Works.

Processing of Instance in Shutdown State

If the database instance is shut down, Veeam Agent skips it and tries to connect to the next instance. The skipped database instance will be included in the backup. You cannot restore such PostgreSQL instance as an independent item using Veeam Explorer for PostgreSQL. You can restore such database instance only using either volume-level or file-level restore.To learn more about restoring volumes and files, see Data Restore.

Processing of Instance in Backup State

If the database instance is in the backup state, depending on the selected PostgreSQL Processing option, Veeam Agent performs the backup job differently:

Processing of Instance with WAL Level Set as Minimal

If the database is running and the WAL level is set as minimal, Veeam Agent forces a WAL checkpoint. This command fastens the database system restore. To learn more, see PostgreSQL documentation.

Keep in mind that the backup of a PostgreSQL instance with the minimal WAL level does not contain logs. As a result, you can restore your instance only to image-level backup state.

Processing of Instance with WAL Level Set as Archival, Replica or Logical

If the database instance is running and the WAL level is set as archival, replica or logical, Veeam Agent performs the following operations:

 

 

Related Tasks

Page updated 12/3/2024

Page content applies to build 6.3.0.73