Secure Agent Services > Process Server > Upgrading the PostgreSQL database using the replication technique
  

Upgrading the PostgreSQL database using the replication technique

If your Process Server PostgreSQL database version is earlier than version 18.4, you can upgrade the database to version 18.4 with minimal downtime by using the replication technique. The upgrade involves verifying host requirements, restarting the Process Server, and enabling the replication upgrade.
To upgrade the database, complete the following tasks:
  1. 1Verify the host requirements.
  2. 2Restart the Process Server.
  3. 3Configure the synchronization workers
  4. 4Enable the replication upgrade.
  5. 5Check the replication progress.
  6. 6Complete the switchover.
Note:
You can't upgrade the PostgreSQL database by using the replication technique on a Secure Agent cluster.
Prerequisites
Restart the Process Server
  1. 1Open the Administrator service and select Runtime Environments.
  2. 2On the Runtime Environments page, click the name of the Secure Agent.
  3. Note:
    You might have to expand the Secure Agent group to see the list of Secure Agents within the group.
  4. 3In the Agent Service Details section, hover over the row that contains the Process Server service and click the Stop Service icon.
  5. 4Click the Start Service icon in the row to restart the Process Server service. After the service starts, the status changes to Up and Running. If the service fails to start, check the audit log on the Monitor tab to find the cause of the error.
Configure the synchronization workers
Configure the maximum number of synchronization workers for each subscription to control how many tables the replication copies in parallel. The default value is 2. Set the value based on your replication load, as shown in the following table:
Load
Data size
Recommended value
Low
<10 GB
2 (default)
Medium
10-100 GB
4
High
100+ GB
6-8
  1. 1On the Secure Agent machine, go to the following directory:
  2. <Secure Agent installation directory>\apps\process-engine\data\PostGreSql\Data
  3. 2Open the user.conf file.
  4. 3To set the number of synchronization workers, add the following property with a value that suits your replication load:
  5. max_sync_workers_per_subscription = <value>
  6. 4Save the user.conf file.
  7. 5To apply the change without restarting the database, connect to the database and run the following query:
  8. SELECT pg_reload_conf();
    If the configuration reloads, the query returns t.
  9. 6To verify the new value, run the following query:
  10. SHOW max_sync_workers_per_subscription;
  11. 7To close the database session, run \q.
Note:
Close the database session before you enable the replication upgrade. An open session can cause the replication to fail.
Enable the replication upgrade
  1. 1On the Secure Agent machine, open a command prompt and go to the following directory:
  2. <Secure Agent installation directory>/apps/process-engine/data/db/util
    Run the database upgrade script with the enable_replication option.
  3. 2Restart the Process Server to start the replication upgrade. In the Process Server logs, confirm that the replication started by looking for the following entries:
  4. Wait for the data replication from the earlier PostgreSQL version to the newer PostgreSQL version to finish. Replication is complete when all the tables are copied to the newer version.
    Note:
    The time replication takes to complete depends on the size of the database.
  5. 3After replication completes, restart the Process Server to complete the switchover to the newer PostgreSQL version. To confirm that the switchover has started, check the Process Server logs for the following entry:
  6. Replication is completed. Starting Switchover.
    The Process Server runs on PostgreSQL version 18.4.
Check the replication progress
Optionally, check the replication progress before you restart the Process Server to complete the switchover.
  1. 1To confirm that a switchover is pending, check for the readyForSwitchover marker file in the following directory:
  2. <Secure Agent installation directory>\apps\process-engine\data\readyForSwitchover
  3. 2Open the file to view the replica details, for example:
  4. port = 58795
    name = postgre-replica-v33
    version = 33
    If the file exists, replication is set up and a switchover is pending.
    Note:
    The port is assigned per run and changes each time. Note the port value for step 4.
  5. 3Browse to the psql folder of the replica. If the version differs, replace postgre-replica-v33 with the name in the marker file.
  6. cd "<Secure Agent installation directory>\apps\process-engine\data\postgre-replica-v33\db\postgresql-<windows or linux>-x64-binaries\pgsql\bin"
  7. 4To connect to the replica database, run the following command with the replica port from step 2. Do not use the default port 5432, which is the source database. Enter the database password when prompted.
  8. Note:
    Replication status is visible only on the replica instance. If you connect to the source database, the query returns 0 rows.
  9. 5At the activevos=# prompt, run the following completeness check:
  10. SELECT count(*) AS total,
    count(*) FILTER (WHERE srsubstate IN ('r','s')) AS ready,
    count(*) FILTER (WHERE srsubstate NOT IN ('r','s')) AS pending
    FROM pg_subscription_rel;
    Replication is complete when ready = total and pending = 0.
  11. 6To close the database session, run \q. Then close the command prompt window.
  12. Note:
    An open connection to the replica database can block the switchover.
Complete the switchover
  1. 1To complete the switchover to the newer PostgreSQL version, restart the Process Server after the replication completes.
  2. 2To confirm that the switchover started, check the Process Server logs for the following entry:
  3. Replication is completed. Starting Switchover
    The Process Server runs on PostgreSQL version 18.4
When you restart the Process Server for the first time, the database starts replicating data from your existing database version. Each time you restart the Process Server, the database verifies the replication status. After replication finishes, the earlier PostgreSQL version shuts down and the newer version starts automatically. This process eliminates the need to manually upgrade the Process Server PostgreSQL database by running the scripts provided by Informatica.