Skip to main content

Database on Primary and Secondary nodes

To start the Primary database:

  1. After editing the configuration details, complete the following steps:

    i. Go to Services and select postgresql-x64-14, and click Start the service.

    ii. Open the SQL Shell (psql) command prompt and run the following backup command: select pg_start_backup('base');

tip

Running the start backup command to ensure that the Primary and Secondary database servers are in sync before they can serve as DR.

  1. Complete the following steps to copy the files from the Primary database to Secondary database:

    i. Go to the data directory in the Primary database and copy the required folders and files.

    tip

    Exclude copying the following files from the Primary database:

    • *.conf
    • postmaster.pid

    ii. Go to the data directory on the Secondary database and copy the folders and files.

    tip

    When copying the files, Copy or Replace option appears. Select the checkbox for all current items and click copy and replace.

  2. After copying the data to the Secondary database, stop the backup command on the Primary database using the following command in the SQL Shell command prompt: select pg_stop_backup();

To start the Secondary database:

After stopping backup on Primary database, start the Secondary Database from services of postgres-x64-14.

To backup Primary node configuration files to Secondary node

Copy C:\Program Files\Postgresql\14\data\postgres.sql, pg_hba files from the Primary node to the Secondary node on C:\Program Files\Postgresql\14\Primary_Bkp.

tip

Use the configuration backup file for rebuilding the Secondary node as the Primary node.