PostgreSQL Streaming Replication in Release
A production setup in Release consists of an external clustered database to store operational and archived data from Release.
In PostgreSQL, continuous archiving can be used to create a high availability (HA) cluster configuration with one or more standby servers ready to take over operations if the primary server fails. This capability is referred to as PostgreSQL in hot-standby setup.
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.
- Add the list of primary and standby PostgreSQL servers to the
db-url
key of theXL_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:
-
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.
-
If it is down, run the following command after logging on to the secondary server:
pg_ctl promote
-
Check if the promotion was successful by checking the logs and verifying that the new primary database is now accepting connections.