Artifactory HA PostgreSQL Configuration with Ansible
Configure JFrog Artifactory HA to use PostgreSQL HA by setting multi-host JDBC connection strings with automatic primary failover in system.yaml.
You can deploy external PostgreSQL instances in High Availability configurations for increased resiliency.
To configure Artifactory HA with PostgreSQL HA:
-
Stop the Artifactory service.
-
Edit the
system.yamlfile and update the following values.The
urlfield under both thesharedandmetadatadatabase sections in the following format.jdbc:postgresql://<PostgreSQL Database 1 URL>,..., <PostgreSQL Database N URL>/artifactory?targetServerType=primary
Understanding the connection parameters
The
targetServerType=primaryparameter applies to the entire connection, not to any individual host in the list. List all PostgreSQL HA nodes (primary and replicas) in the URL, separated by commas. The JDBC driver automatically discovers which node is currently the primary and connects to it.This enables automatic failover: if the primary changes, the driver reconnects to the new primary on the next connection attempt.
The following sample shows an example system.yaml file configuration.
systemYaml:
shared:
logging:
...
database:
type: postgresql
url: "jdbc:postgresql://17.21.0.2:5432,17.21.0.3:5432/artifactory?targetServerType=primary"
driver: org.postgresql.Driver
username: "artifactory"
password: "password"
artifactory:
Database:
...
frontend:
...
access:
...
metadata:
database:
type: postgresql
url: "jdbc:postgresql://17.21.0.2:5432,17.21.0.3:5432/artifactory?targetServerType=primary"
driver: org.postgresql.Driver
username: "artifactory"
password: "password"
...- Start the Artifactory service.
Updated 7 days ago
