Backing up RedHat Virtualization Manager

It is important to maintain complete backups of the machine running Red Hat Virtualization Manager, especially when making changes to the configuration of that machine. As part of a backup strategy, the engine-backup utility can be used to back up the RHVM database and configuration files into a single archive file that can be easily stored.

NOTE: The engine-backup command only backs up key configuration files, the engine database, and the Data Warehouse database of your RHVM installation. It does not back up the operating system or installed software. The restore process requires that the RHVM server has been reinstalled with an operating system and the RHVM software packages, but that engine-setup has not yet been run. In addition, engine-backup does not backup virtual machines.

The engine-backup command works in one of two basic modes: engine-backup –mode=backup and engine-backup –mode=restore These two modes are further extended by a set of options that allow administrators to specify the scope of the backup and different credentials for the engine database.

Consider the following basic options:

1. –mode=mode – Specifies the operating mode of the command. Two modes are available: backup, which creates a backup, and restore, which restores a backup. This option is required.
2. –file=backup-file – Specifies the location of the archive file containing the backup. This option is required.
3. –log=log-file – Specifies the location of a file used to record log messages from the backup or restore operation. This option is required.
4. –scope=scope – Specifies the scope of the backup or restore operation. There are four scopes:

  • all – backup or restore the engine database, Data Warehouse, and RHVM configuration files (the default option)
  • db – backup or restore only the engine database
  • files – backup or restore only RHVM configuration files
  • dwhdb – backup or restore only the Data Warehouse database

This post uses a standard RHVM installation running the engine, engine database, and Data Warehouse on the same server. In this case, –scope=all may be the easiest way to create backups. The other scopes are most useful for backing up more complex or advanced RHVM configurations. Note that you can run engine-backup while RHVM is running.

When using engine-backup to restore the database from a backup, there are options which may be needed:

OPTION DESCRIPTION
–provision-db Creates a PostgreSQL database for the RHVM engine on the server being restored. Used when restoring to a fresh installation that has not been setup.
–provision-dwh-db Creates a database for the Data Warehouse on the server being restored. Used when restoring to a fresh installation that has not been setup.
–restore-permissions Restores database permissions stored in the backup. Used when restoring to a fresh installation or when overwriting an installation that has been set up.

This is the procedure for creating a full backup of a RHVM server:

1. Log in to the server installed with RHVM.

2. Once logged in, run a command, such as the following, to create a full backup. This creates an archive in /root/rhv-backup.tgz and a log of the backup in /root/backup.log.

[[email protected] ~]# engine-backup --scope=all --mode=backup 
> --log=/root/backup.log --file=/root/rhv-backup.tgz
Backing up:
Notifying engine
- Files
- Engine database 'engine'
- DWH database 'ovirt_engine_history'
Packing into file 'rhv-backup.tgz'
Notifying engine
Done.

3. The tar file (/root/rhv-backup.tgz in the example) contains a backup of RHVM configuration files, the engine database, and the Data Warehouse database. This backup archive should be copied off of the RHVM server to secure storage for later use.

Restoring RedHat Virtualization Manager

While the process for restoring a backup using the engine-backup command is straightforward,it involves several additional steps in comparison to that for creating a backup, depending on the destination to which the backup is to be restored. For example, the engine-backup command can be used to restore backups to fresh installations of Red Hat Virtualization, on top of existing installations of Red Hat Virtualization, and using local or remote databases.

Warning: Backups can only be restored to environments of the same major release as that of the backup. For example, a backup of a Red Hat Virtualization version 4.1 environment can only be restored to another Red Hat Virtualization version 4.1 environment. To view the version of Red Hat Virtualization contained in a backup file, administrators can unpack the backup file and read the value in the version file located in the root directory of the unpacked files.

The engine-backup command can be used to restore a backup to a fresh installation of the Red Hat Virtualization Manager. The following procedure must be performed on a machine on which the base operating system has been installed and the required packages for the Red Hat Virtualization Manager have been installed, but the engine-setup command has not yet been run. This procedure assumes that the backup file can be accessed from the machine on which the backup is to be restored.

Consider the following steps in order to restore a backup:

1. Log in to the machine on which the Red Hat Enterprise Virtualization Manager is installed.

2. Restore the full backup using the engine-backup command. Since the machine has not been set up, use the –provision-db option to provision the engine database, the –provision-dwh-db option to provision the Data Warehouse database, and the –restorepermissions option to restore the permissions for the databases:

[[email protected] ~]# engine-backup --mode=restore --file=backup-file.tgz --log=log-file
 
> --provision-db --provision-dwh-db --restore-permissions

If successful, the following output displays:

You should now run engine-setup.
Done.

3. Run the command and follow the prompts to configure the engine:

[[email protected] ~]# engine-setup

4. The engine database and configuration files for the Red Hat Virtualization Manager have been restored to the version in the backup.

Over-writing an RHVM Installation

If there is an existing RHVM installation which has already had the engine-setup command executed, it is possible to overwrite it, speeding up the restoration process by keeping installed packages. This process does not need to reinitialize the databases.

Consider the following steps in order to restoring a backup to overwrite an existing installation:

1. Log in to the machine on which Red Hat Virtualization Manager is installed.

2. Run this command, and follow the prompts to remove the configuration files and clean the database associated with the manager:

[[email protected] ~]# engine-cleanup

3. Restore a full backup using the engine-backup command:

[r[email protected] ~]# engine-backup --mode=restore --file=backup-file.tgz --log=log-file
 
> --restore-permissions

If successful, the following output displays:

You should now run engine-setup.
Done.

4. Run this command and follow the prompts to configure the engine:

[[email protected] ~]# engine-setup

Optionally, use the –config-append option in order to speed up the configuration process.This argument lets you reuse the RHVM installation answers configuration file from the original installation.

[[email protected] ~]# engine-setup --config-append=/root/answers.txt