Configure Artifactory HA to Use PostgreSQL Database in HA in Ansible
Configure JFrog Artifactory HA in Ansible to use external PostgreSQL instances deployed in high-availability mode for increased resiliency.
You can deploy external PostgreSQL instances in High Availaibility configurations for increased resiliency.
To configure Artifactory HA with PostgreSQL HA:
-
Stop the Artifactory service.
-
Edit the
system.yamlfile and update the following values.
Note
Artifactory uses multiple drivers. Configure the connection strings separately for each driver.
-
The
urlfield under theshareddatabase section in the following format.jdbc:postgresql://<PostgreSQL Database 1 URL>,..., <PostgreSQL Database N URL>/artifactory?targetServerType=primary -
The
urlfield under themetadatadatabase section in the following format.jdbc:postgresql://<PostgreSQL Database 1 URL>,..., <PostgreSQL Database N URL>/artifactory?target_session_attrs=read-write
Understanding the connection parameters
The
targetServerType=primaryandtarget_session_attrs=read-writeparameters apply 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?target_session_attrs=read-write"
driver: org.postgresql.Driver
username: "artifactory"
password: "password"
...- Start the Artifactory service.
Updated 19 days ago
