Backup and Restore
You can use the engine-backup
command utility to take regular backups of
Oracle Linux Virtualization Manager. The tool backs up the engine database and configuration
files into a single file and can be run without interrupting the ovirt-engine
service.
The engine-backup
command has two modes:
# engine-backup --mode=backup
# engine-backup --mode=restore
Run engine-backup --help
for a full list of options and their function.
The basic options are:
--mode
Specifies whether the command performs a backup operation or a restore operation. The
available options are: backup
(default), restore
, and
verify
.
--file
Specifies the path and name of the backup file, for example,
file_name.backup
. For backup mode, the file is where backups are
saved. For restore mode, the fileis read as backup data. The default path is
/var/lib/ovirt-engine-backup/
.
--log
Specifies the path and name of the log file, for example,
log_file_name
. This file logs the backup or restore operations. The
default path is /var/log/ovirt-engine-backup/
.
--scope
engine-backup
command. There are four options:
all
(default) - back up or restore all databases and configuration datafiles
- back up or restore only files on the systemdb
- back up or restore only the Engine databasedwhdb
- back up or restore only the Data Warehouse database
For more information on backup and restore, see the oVirt documentation Administration Guide.
Backing Up the Manager
To backup the Manager:
-
Log into the host that is running the Manager.
Note:
When running the Manager within a virtual machine (standalone or self-hosted engine) log into the virtual machine that is running the engine.
-
Create a full backup of the Manager. You do not need to stop the ovirt-engine service before creating your backup.
# engine-backup --mode=backup --scope=all --file=path --log=path
The following example shows how to use the engine-backup command to create a full backup of the Manager. A backup file and log file for the Manager backup is created in the path specified.
# engine-backup --mode=backup --scope=all --file=backup/file/ovirt-engine-backup --log=backup/log/ovirt-engine-backup.log Backing up: Notifying engine - Files - Engine database 'engine' - DWH database 'ovirt_engine_history' Packing into file 'backup/file/ovirt-engine-backup' Notifying engine Done.
-
(Optional) Set up a
cron
job to take regular backups.By default, the Manager does not take automatic backups. Oracle recommends that you take you regular backups of the Manager.
The following example shows a sample
cron
job defined in acrontab
-format file.today=`date +'%Y%m%d-%H%M'` engine-backup --mode=backup --scope=all --file=/backup/file/ovirt-engine-backup-${today} --log=/backup/log/ovirt-engine-backup-${today}.log
Restoring a Full Backup of the Manager
To restore a full backup of the Manager:
-
Login to the host that is running the Manager.
Note:
When running the Manager within a virtual machine (standalone or self-hosted engine) log into the virtual machine that is running the engine.
-
Clean up the objects associated with the Manager.
# engine-cleanup
This engine-cleanup command removes the configuration files and cleans the database associated with the Manager.
The following example shows output from the engine-cleanup command.
# engine-cleanup [ INFO ] Stage: Initializing [ INFO ] Stage: Environment setup Configuration files: ... Log file: ... Version: otopi-1.7.8 (otopi-1.7.8-1.el7) [ INFO ] Stage: Environment packages setup [ INFO ] Stage: Programs detection [ INFO ] Stage: Environment customization Do you want to remove all components? (Yes, No) [Yes]: Yes The following files were changed since setup: /etc/ovirt-engine/engine.conf.d/11-setup-sso.conf Remove them anyway? (Yes, No) [Yes]: Yes --== PRODUCT OPTIONS ==-- [ INFO ] Stage: Setup validation During execution engine service will be stopped (OK, Cancel) [OK]: OK All the installed ovirt components are about to be removed ...(OK, Cancel) [Cancel]: OK [ INFO ] Stage: Transaction setup [ INFO ] Stopping engine service [ INFO ] Stopping ovirt-fence-kdump-listener service [ INFO ] Stopping dwh service [ INFO ] Stopping Image I/O Proxy service [ INFO ] Stopping vmconsole-proxy service [ INFO ] Stopping websocket-proxy service [ INFO ] Stage: Misc configuration [ INFO ] Stage: Package installation [ INFO ] Stage: Misc configuration [ INFO ] Backing up PKI configuration and keys ... [ INFO ] Clearing Engine database engine ... [ INFO ] Clearing DWH database ovirt_engine_history [ INFO ] Removing files [ INFO ] Reverting changes to files ... [ INFO ] Stage: Transaction commit [ INFO ] Stage: Closing up --== SUMMARY ==-- Engine setup successfully cleaned up A backup of PKI configuration and keys is available at ... ovirt-engine has been removed A backup of the Engine database is available at ... A backup of the DWH database is available at ... --== END OF SUMMARY ==-- [ INFO ] Stage: Clean up Log file is located at ... [ INFO ] Generating answer file ... [ INFO ] Stage: Pre-termination [ INFO ] Stage: Termination [ INFO ] Execution of cleanup completed successfully
-
Restore a full backup of the Manager.
The following form of the engine-backup command is used to a restore a full backup of the Manager.
engine-backup --mode=restore --scope=all --file=path --log=path --restore-permissions
The following example shows how to use the engine-backup command to restore a full backup of the Manager.
# engine-backup --mode=restore --scope=all --file=backup/file/ovirt-engine-backup \ --log=backup/log/ovirt-engine-backup.log --restore-permissions Preparing to restore: - Unpacking file 'backup/file/ovirt-engine-backup' Restoring: - Files - Engine database 'engine' - Cleaning up temporary tables in engine database 'engine' - Updating DbJustRestored VdcOption in engine database - Resetting DwhCurrentlyRunning in dwh_history_timekeeping in engine database - Resetting HA VM status ------------------------------------------------------------------------------ Please note: The engine database was backed up at 2019-03-25 12:48:02.000000000 -0700 . Objects that were added, removed or changed after this date, such as virtual machines, disks, etc., are missing in the engine, and will probably require recovery or recreation. ------------------------------------------------------------------------------ - DWH database 'ovirt_engine_history' You should now run engine-setup. Done.
-
Run the engine-setup command to complete the setup of the restored Manager.
# engine-setup
This command reconfigures the firewall and ensures that the Manager service is correctly configured.
-
Log in to the Manager and verify that the Manager has been restored to the backup.