When the PostgreSQL Server is corrupted or lost, you can restore and recover it from the latest full backup. Both the data and logs can be restored using the FSBasedBackupSets.
For a cluster-to-cluster restore, perform the browse operation from the FSBased backup set level. You can select either the in-place or out-of-place restore option, depending on your requirement.
Note
To restore to a specific point in time, the pg_rewind utility is used to rewind the PostgreSQL data directory on standby nodes to match the state of the master node. Ensure that the wal_log_hints parameter is set to on in the configuration file or that data checksums were enabled during cluster initialization for pg_rewind to run successfully. For more information, see pg_rewind.
Before You Begin
-
File system backups must be restored only of the same PostgreSQL instance version. Cross-version restores (upgrade or downgrade) are not supported.
-
For Snap and Block-level instances, stop the PostgreSQL server on the destination nodes before initiating the restore. Clean up the data, tablespace, and archive log directories, ensuring that the required configuration files are preserved.
-
The following configuration files must be retained in the data directory:
-
Master: pg_hba.conf, pg_ident.conf, postgresql.auto.conf, postgresql.conf
-
Standby: pg_hba.conf, pg_ident.conf, postgresql.auto.conf, postgresql.conf, standby.signal
-
-
An empty file named standby.signal must be present in the data directory of all standby server instances.
-
In the case of a redirect restore where the destination instance data directory path differs from the path recorded in the backup, ensure that the recovery.conf files are present in the new data directory path.
-
If using a cluster manager such as EnterpriseDB Failover Manager (EFM), repmgr or Patroni, ensure that all associated cluster manager configuration files on both primary and standby instances are present and correctly configured.
Procedure
-
From the CommCell Browser, navigate to Client > PostgreSQL > PostgreSQL Cluster Client.
-
Right-click FSBasedBackupSet, and then click All Tasks > Browse and Restore.
-
Click View Content.
-
Select the data that you want to restore, and then click Recover All Selected.
The PostgreSQL Database Restore Options dialog box appears.
-
Select the Restore in place checkbox, and then click Next.
By default, the server is restored to the data directory path that matches the source.
-
In the General tab, perform the following actions:
-
Ensure both Destination Client and Destination Instance are selected as cluster clients.
-
In the Number of Streams box, enter the number of streams to use for the restore operation.
Note
The number of streams cannot be set lower than the number of clients available in the cluster.
-
Select the Recover Database Server checkbox.
You can clear this checkbox if you do not want the PostgreSQL Server to start automatically after the restore completes.
-
-
In the Cluster Restore Options tab, perform the following actions:
-
The Restore data to the entire cluster checkbox is selected by default.
Note
When Restore data to entire cluster is selected, the restore operation is performed at the cluster level and the data is restored as a cluster to all nodes. When this option is not selected, you must choose a specific cluster node as the restore target. In this case, PostgreSQL server is restored only to the selected node and is brought up as a standalone read-write server.
-
In the Cluster Node list, select the cluster client.
-
In the Client Name section:
-
In the Server Start Command box, specify a custom server start command, if required.
-
In the Cluster Manager Start Command box, specify a custom cluster manager start command, if required.
Note
This option is unavailable for Native Replication cluster types.
-
If you need to change the data directory from its default path, select the Redirect checkbox and specify the desired location.
Note
If you select a new path, make sure that the PostgreSQL configuration files mentioned in prerequisites are copied from the default path to the new path.
-
-
Click OK to start the restore.