Creating a backup of the appliance will be done using SSH or the console.
appliance_console
Create Database Backup
and choose a backup location (/tmp/evm_db.backup is the default)Quit
to return to the shell tar -czvf /root/backup.tgz /tmp/evm_db.backup /var/www/miq/vmdb/GUID /var/www/miq/vmdb/certs/v2_key
/root/backup.tgz
Scheduling a database backup using crontab and pg_dump.
This example will create a backup file in /tmp
named something like db_dump20231009T145028.dump
.
Before adding the cron job it would be best practice to mount an external storage and adjust the example accordingly.
crontab -e
i
to insert and add a line with the desired schedule to run the backup job. Examples:
# Every hour on the hour
0 * * * * pg_dump -Fc vmdb_production > /tmp/db_dump$(date +\%Y\%m\%dT\%H\%M\%S).dump
# Every day at midnight
0 0 * * * pg_dump -Fc vmdb_production > /tmp/db_dump$(date +\%Y\%m\%dT\%H\%M\%S).dump
# Every week at midnight on Sunday
0 0 * * 0 pg_dump -Fc vmdb_production > /tmp/db_dump$(date +\%Y\%m\%dT\%H\%M\%S).dump
Esc
to exit insert mode then :wq
and hit Enter
to write and quit. If successful, it will output crontab: installing new crontab
/var/log/cron
Restoring a backup of the appliance will be done using SSH or the console.
hostnamectl hostname your-new-hostname.example.com
echo "your.ip.address your-new-hostname.example.com your-new-hostname" >> /etc/hosts
/
cd /
tar -zxf /backup.tgz
rm -f /backup.tgz # if desired to save space
appliance_console
Configure Application
.
Create Internal Database
Stop EVM Server Processes
Restore Database From Backup
Start EVM Server Processes