Skip to main content
Version: Release 22.2

PostgreSQL Streaming Replication in Release

This topic covers the setup of a production environment in Digital.ai Release using an external clustered database for operational and archived data. It also includes configuring PostgreSQL in a hot-standby setup for high availability with standby servers ready to take over if the primary server fails.

For more information, see Streaming Replication.

Important: The PostgreSQL streaming replication setup is supported only for JVM sites.

Setup the PostgreSQL Replicas

Set up one or more PostgreSQL standby servers for Release.

For more information, see:

Important: Streaming replication is asynchronous by default.

Monitor PostgreSQL Server Failures

For a production setup, it is recommended that you set up a proactive monitoring tool to monitor your applications.

Digital.ai Release exposes internal and system metrics over JMX. Any monitoring system that can read JMX data can be used to monitor Release.

Here's a list of widely used monitoring tools:

When the primary database server goes down, any of the available monitoring tool can alert the administrator to the issue. At this point, the administrator will need to manually promote the secondary database to become the new primary database.

Here's how you set up Streaming Replication in Release step-by-step once you have your PostgreSQL cluster in place for Streaming Replication.

Step 1—Configure the xl-release.conf file

At this point, suppose, you have Digital.ai Release installed.

  1. Add the list of primary and standby PostgreSQL servers to the db-url key of the XL_RELEASE_SERVER_HOME/conf/xl-release.conf file.

Here's an example.

xl {
database {
db-driver-classname="org.postgresql.Driver"
db-password="{aes:v0}Tlhw1r7VHoCfToUpmQif9+M20/tBf6c0Ei8a3ySikt0="
db-url="jdbc:postgresql://localhost:5470,localhost:5480/xlrelease"
db-username=xlrelease
}
reporting {
db-driver-classname="org.postgresql.Driver"
db-password="{aes:v0}rF7pd4/5thp4PsyWyeWSMiN+v+EyjRcKp4As2PJg7MY="
db-url="jdbc:postgresql://localhost:5470,localhost:5480/xlarchive"
db-username=xlarchive
}
}

You can see that two DB servers are being used. The localhost:5470 is the Master/Primary PostgreSQL server with both Read and Write permissions to the database, and localhost:5480 is the Slave/Secondary DB with Read-only permission to the database.

Manual Promotion

To promote a secondary database to become the new primary database in a PostgreSQL streaming replication setup:

  1. Check the status of the primary database to confirm that it is actually down and not just experiencing a network issue or other transient problem.

  2. If it is down, run the following command after logging on to the secondary server:

    pg_ctl promote
  3. Check if the promotion was successful by checking the logs and verifying that the new primary database is now accepting connections.