Setting up the Cluster for Postgres Failover
Once database replication has been set up, the following changes to Clarify Server Cluster are required in order for failover to work. Changes occur in two property files:
- shared.properties
- JDBCSetup.properties
Edit the shared.properties
Position to <Clarify Install Directory>/<Clarify_Share>/
There are three new properties that can be changed or added to your shared.properties file.
- ebi.database.failoverThreshold – An amount of time, in milliseconds, during which Clarify will wait to receive an ‘OK’ health status from the master database. If no ‘OK’ status is returned during this interval, the failover process begins. Default value: 120000 (2 minutes)
- ebi.database.failoverHosts – A comma separated list of IP addresses or DNS names of the machines (or VMs) that the master and standby database, i.e. 10.10.2031,10.10.20.32. There should not be more than two hosts listed (or two replicating databases).
- ebi.database.errorCodes – A comma separated list of Postgres error codes that Clarify will filter out Exception messages for, placing them in separate failover log files. The default list should cover common error codes, but more could be added if you are seeing specific errors that are not being logged. Default list: 57P01,57P02,25006,08006
Edit the JDBCSetup.properties
Position to <Clarify Install Directory>/<Clarify_Share>/resources/config/server/persistence.
Two existing properties within this file must be altered. Both the JDBCSetup.URL and the
JDBCSetup.cacheURL will have to be expanded to include a comma separated list of URLs (one for the master, one for the standby), as well as a targetServerType argument.
JDBCSetup.URL - The JDBC driver uses this URL for internal database connections. A second address and the targetServerType argument will need to be added. For example:
Original URL:
jdbc\:postgresql\://172.16.1.1\:${db.port}/ebi4
New URL:
jdbc\:postgresql\://172.16.1.1\:${db.port},172.16.1.2\:${db.port}/ebi4?targetServerType=master
JDBCSetup.cacheURL - This URL is used for cached internal connections. For example:
Original URL:
jdbc\:cache\:postgresql\://172.16.1.1\:${db.port}/ebi4
New URL:
jdbc\:cache\:postgresql\://172.16.1.1\:${db.port},172.16.1.2\:${db.port}/ebi4?targetServerType=master
Restart the Clarify Server Cluster
The Server Cluster must be restarted to apply the above settings. This assumes the cluster was running during the previous steps.
- Use the clarify_ctl.bat(or sh) -shutdownCluster to shut down the Clarify Server.
- Start each clarify service in the Server Cluster.