Back Up and Restore Database
Axon automatically backs up the PostgreSQL database according to the predefined schedule. You can also back up the Axon PostgreSQL database manually and restore it to another instance of the same Axon version. If you installed the PostgreSQL database on an external node, you can take a backup of the external database and restore it to another instance.
You might want to back up and restore the Axon database under the following circumstances:
- •You want to have the same data for multiple Axon instances.
- •You want to restore data that you backed up earlier.
- •You want to move data from a test environment to a production environment.
- •You want to move data
When Axon backs up the database automatically, the backup scheduler keeps the backups at the following location: <INSTALLATION_DIR>/axonhome/db-backups/postgres_backups/
Note: To perform a backup and restore of external databases, such as Microsoft Azure Database for PostgreSQL and Amazon RDS, you need to contact your database administrator.
Back Up Database
To back up the database, run the script file axon_db_backup.sh that contains the details of the backup. Perform the following tasks to back up the Axon database at the source location.
1. Go to the <INSTALLATION_DIR>/scripts directory and run the following command to back up the database:
sh axon_db_backup.sh <BACKUP_TARGET_DIR>
2. If you have configured custom passwords for PostgreSQL database users during or after Axon installation, create a .conf file to store all the custom passwords and copy the file to a location that you can access later.
Enter passwords in the .conf file in the same format as the password.conf file at the following location:
<INSTALLATION_DIR>/config/password.conf
Use the following required format:
<configuration parameter>=<encrypted password>
For example, enter the encrypted password of the Value List database user in the following format in the .conf file:
VALUELIST_PWD=<encrypted VALUELIST_Password>
3. Go to the backup target directory to verify that the database backup file is created. The database backup is an SQL file with the timestamp: <BACKUP_TARGET_DIR>/<backup_sql_file>
For example, your backup file might look like this: <BACKUP_TARGET_DIR>/postgres_2018_06_24_025744.sql
Restore Database
You can restore the Axon database to a target location. After restoring the database, restart Axon, reindex the database, and restore the Axon settings. If you have performed any file-level customization in the source instance, ensure that you make the same changes in the target instance.
1. Go to the <INSTALLATION_DIR>/bin target location where you have installed Axon and run the following command to shut down the Axon instance:
sh shutdown.sh
2. Go to the <INSTALLATION_DIR>/axonhome/third-party-app/scripts directory, and run the following command to restart the PostgreSQL database service:
sh postgresql restart
3. Run the following command to define the Axon environment variable so that the Linux system can access the Axon resources at the correct location:
source <INSTALLATION_DIR>/scripts/exportEnv.sh
4. Run the following command to restore the database from the backup file:
<INSTALLATION_DIR>/axonhome/third-party-app/postgresql/bin/psql -U <Axon_Administrator> -d postgres -h <INSTALLATION_DIR>/axonhome/third-party-app/config/postgres -f <full_path_to_backup_postgresql_file>
For example, run the following command:
$AXON_HOME/third-party-app/postgresql/bin/psql -U $AXON_USER -d postgres -h $AXON_HOME/third-party-app/config/postgres -f <BACKUP_TARGET_DIR>/postgres_2018_06_24_025744.sql
You can ignore any user or role error message that might be displayed.
5. Reapply your Axon customization settings in the .ymlc or .yml files.
6. If you have not configured custom passwords for PostgreSQL database users, skip this step. If you have configured custom passwords for PostgreSQL database users, perform the following additional steps to restore them:
- a. If you have not configured the password for the Workflow service password, skip this step. If you have configured the password for the Workflow service, run the following command and update the unencrypted password manually:
vi <INSTALLATION_DIR>/axonhome/camunda/server/apache-tomcat-9.0.37/conf/server.xml
- b. Ensure that the .conf file has all the custom passwords in the same format as the <INSTALLATION_DIR>/config/password.conf file in a location that you can access.
- c. To configure the Axon deployment with custom passwords, run the following commands:
cd <INSTALLATION_DIR>/bin
sh changeDBPassword.sh <Full_Path_to_Custom_Passwords_File>
7. Go to the <INSTALLATION_DIR>/bin location and run the following command to start Axon:
sh startup.sh
8. Go to the <INSTALLATION_DIR>/scripts directory and run the following script to reindex the database:
sh reIndex.sh
9. Check the Enterprise Data Catalog and Informatica Data Quality settings to make sure that they point to the target Axon instance.
10. Verify that all Axon services are running properly. Log in to Axon as an administrator, go to the Admin Panel, and view the Admin Dashboard. The Status of Axon Services section shows the services that are operational.
Back Up External PostgreSQL Databases
If the objects database is deployed on an external node, Axon automatically backs up the PostgreSQL database according to the predefined schedule. The backup scheduler keeps the backups at the following location: <external_directory_PostgreSQL_path>/db_backup/postgres_backup
If Axon is installed in HTTPS protocol, the Axon application communicates with the external database node using SSL authentication.
1. Log in to the external node, and go to the directory where the PostgreSQL database is deployed.
2. Run the following command to back up the database:
sh axon_db_backup_external.sh
3. If you have configured custom passwords for PostgreSQL database users during or after Axon installation on the external database, create a .conf file to store all the custom passwords and copy the file to a location that you can access later.
Enter the password in the .conf file in the same format as the password.conf file at the following location:
<INSTALLATION_DIR>/config/password.conf
Use the following required format:
<configuration parameter>=<encrypted password>
For example, enter the encrypted password of the Unison database user in the following format in the .conf file:
UNISON_DB_PWD=<encrypted UNISON_DB_Password>
4. Go to the <external_directory_PostgreSQL_path>/db_backup directory to verify that the database backup file is created.
Restore External PostrgreSQL Databases
If the objects database is deployed on an external node, Axon automatically backs up the PostgreSQL database according to the predefined schedule. The backup scheduler keeps the backups at the following location: <external_directory_PostgreSQL_path>/db_backup/postgres_backup
1. On the Axon host, go to the <INSTALLATION_DIR>/bin destination location where you have installed Axon and run the following command to shut down the Axon instance:
sh shutdown.sh
2. Log in to the external node, and go to the directory where the PostgreSQL database is deployed.
3. Run the following command to define the Axon environment variable so that the Linux system can access the Axon resources at the correct location:
export LD_LIBRARY_PATH=<external_directory_PostgreSQL_path>/postgresql/lib:$LD_LIBRARY_PATH
4. Go to the <external_directory_PostgreSQL_path>/postgresql/bin directory and run the following command to restart the PostgreSQL database service:
sh postgresql restart
5. Run the following command to restore the external database from the backup file:
<external_directory_PostgreSQL_path>/postgresql/bin/psql -U <Axon_Administrator> -d postgres -h <external_directory_PostgreSQL_path>/postgresql/run/postgres -f <full_path_to_backup_postgresql_file>
For example, run the following command:
<INSTALLATION_DIR>/axonhome/third-party-app/postgresql/bin/psql -U nroot -d postgres -h <external_directory_PostgreSQL_path>/postgresql/run/postgres -f <BACKUP_DESTINATION_DIR>/postgres_2018_06_24_025744.sql
You can ignore any user or role error message that might be displayed.
6. Reapply your Axon customization settings in the .ymlc or .yml files.
7. If you have not configured custom passwords for PostgreSQL database users on the external database, skip this step. If you have configured custom passwords for PostgreSQL database users on the external database, perform the following additional steps to restore them:
- a. If you have not configured the password for the Workflow service password, skip this step. If you have configured the password for the Workflow service, run the following command and update the unencrypted password manually:
vi <INSTALLATION_DIR>/axonhome/camunda/server/apache-tomcat-9.0.37/conf/server.xml
- b. Ensure that the source .conf file has all the custom passwords in the same format as the <INSTALLATION_DIR>/config/password.conf file in a location that you can access.
- c. To configure the Axon deployment with custom passwords, run the following commands:
cd <INSTALLATION_DIR>/bin
sh changeDBPassword.sh <Full_Path_to_Custom_Passwords_File>
8. On the Axon host, go to the <INSTALLATION_DIR>/bin location and run the following command to start Axon:
sh startup.sh
9. Go to the <INSTALLATION_DIR>/scripts directory and run the following script to reindex the database:
sh reIndex.sh
10. Check the Enterprise Data Catalog and Informatica Data Quality settings to make sure that they point to the destination Axon instance.
11. Verify that all Axon services are running properly. Log in to Axon as an administrator, go to the Admin Panel, and view the Admin Dashboard. The Status of Axon Services section shows the services that are operational.
Backup and Restore Admin Activity History
When you migrate Axon from one instance to another, you must manually migrate the admin activity history. The admin activity history is stored in the Elasticsearch database.
1. Run the following commands in the Linux environment to take a snapshot of the admin activity history data:
TIMESTMP=`date +%m%d%Y%H%M%S`
SNAPSHOT_NAME="upgrade-snapshot-$TIMESTMP"
. <OLD_INSTALLATION_DIR>/scripts/elasticsearch_backup.sh $SNAPSHOT_NAME
2. Copy the snapshot files from the <OLD_INSTALLATION_DIR>/scripts/axonhome/elasticsearch_backup directory to the <NEW_INSTALLATION_DIR>/axonhome/elasticsearch_backup/ directory.
3. Run the following commands to restore the admin activity history to the new Axon instance:
. <NEW_INSTALLATION_DIR>/scripts/elasticsearch_restore.sh $SNAPSHOT_NAME
rm -rf <NEW_INSTALLATION_DIR>/axonhome/elasticsearch_backup/*
sh <NEW_INSTALLATION_DIR>/axonhome/third-party-app/scripts/elasticsearch restart true
sh <NEW_INSTALLATION_DIR>/axonhome/third-party-app/scripts/logstash restart true