Backup and Restore AmpCon Database Securely for Disaster Recovery Purpose
The following steps will backup AmpCon database and encrypt the saved contents:
- Use the following Linux command to back up the entire AmpCon database:
mysqldump -u<user name> -p<password> --databases automation > /root/automation/db_backup/automation_backup.sql
The above command will back up all the tables of automation database to the following file
/root/automation/db_backup/automation_backup.sql - Encrypt the backup file with following command by using a password(<secret-pin>)
  cd /root/automation/db_backup
  openssl aes-256-cbc -e  -in automation_backup.sql -out sql.enc  -k ‘<secret-pin>’
The following steps will decrypt the saved contents and restore the AmpCon database when needed:
- Decrypt the saved database using the following command:
openssl aes-256-cbc -d -in sql.enc -out automation_backup.sql -k <secret-pin> - Stop the automation UI process using the following command:
systemctl stop automation - set the foreign_key_checks to off as follows:
mysql -u<user name> -p<password> -e 'SET GLOBAL FOREIGN_KEY_CHECKS=0' - Use the following Linux commands to restore the AmpCon automation database from a backup file as follows:
mysql -u<user name> -p<password> automation < /root/automation/db_backup/automation_backup.sql - set the foreign_key_checks back to on as follows:
mysql -u<user name> -p<password> -e 'SET GLOBAL FOREIGN_KEY_CHECKS=1' - Restart the automation UI process using the following command:
systemctl restart automation
Copyright © 2024 Pica8 Inc. All Rights Reserved.