ARTIFACTORY: How to Backup and Recover Artifactory Database

AuthorFullName__c
Jagan Sekaran
articleNumber
000006053
FirstPublishedDate
2024-03-14T06:33:47Z
lastModifiedDate
2025-05-22

ARTIFACTORY: How to Backup and Recover Artifactory Database

To ensure the safety of your Artifactory instance, one essential aspect is the regular backup of your database. This guide will walk you through the steps of backing up and recovering an Artifactory instance based on a PostgreSQL database. However, these steps apply to other databases such as MySQL, Oracle, and MS-SQL.

Why Backup Matters

Before diving into the backup and recovery process, let's emphasize the importance of regular backups. Accidents happen, whether it's a hardware failure, a software glitch, or accidental deletion. Without a proper backup strategy, you risk losing critical data, potentially leading to downtime and operational disruptions. By following these steps, you can safeguard your Artifactory instance and minimize the impact of unforeseen events.

Database Backup Steps
1. PostgreSQL Backup

Since this document describes using PostgreSQL as your Artifactory database, the first step is to execute the following command to create a backup:

pg_dump -U artifactory-username artifactory-password > art-dump.sql

This command exports the database to a SQL file, serving as your backup. Ensure that you replace `artifactory-username` and `artifactory-password` with your actual database credentials.

2. Backup the `etc` Folder

Back up the `'$JFROG_HOME/var/etc` folder, which contains critical configuration files, including the master.key. This file is crucial for Artifactory's encryption and security features. Make a copy of this folder to ensure you have all the necessary configuration files for a full recovery. -jfrog home**

Database Recovery Steps
1. Import the Backup

To restore your Artifactory instance from a backup, use the following command:

psql -U artifactory-username artifactory-password < art-dump.sql

This command imports the previously created SQL backup into the PostgreSQL database. Again, make sure to replace `artifactory-username` and `artifactory-password` with your actual database credentials.

2. Restore $JFrog_home/etc Files

Copy the master.key and other files from the backed-up '$JFROG_HOME/var/etc` folder into the new Artifactory directory. This step ensures that your Artifactory instance retains its original configuration, including encryption keys.

3. Update system.yaml

In the new Artifactory directory, locate the system.yaml file. Update the database configuration to reflect the changes made during the recovery process. Update the `database:` section to use the new database credentials.

4. Restart Artifactory

That's it! You've successfully backed up and restored your Artifactory instance. Now, restart Artifactory to apply the changes:

By following these steps, you can confidently manage the backup and recovery process for your Artifactory instance, ensuring data integrity and minimizing the impact of potential disruptions. Remember to adapt these steps to your specific database type if you're not using PostgreSQL. Regularly perform these backups to keep your Artifactory instance robust and reliable, even at higher scales ranging from 100k to 1 million and beyond.