Red Hat Training

A Red Hat training course is available for Red Hat Gluster Storage

Chapter 11. Backing Up and Restoring the Red Hat Storage Console

The Red Hat Storage Console maintains important information about the environment and therefore must be regularly backed up. Regular backups ensure that Red Hat Storage Console can recover a previous state simply and quickly.

11.1. Backing Up and Restoring the Red Hat Storage Console

11.1.1. Backing up Red Hat Storage Console - Overview

While taking complete backups of the machine on which the Red Hat Storage Console is installed is recommended whenever changing the configuration of that machine, a utility is provided for backing up only the key files related to the Manager. This utility - the engine-backup command - can be used to rapidly back up the engine database and configuration files into a single file that can be easily stored.

11.1.2. Syntax for the engine-backup Command

The engine-backup command works in one of two basic modes:
# engine-backup --mode=backup
# engine-backup --mode=restore
These two modes are further extended by a set of parameters that allow you to specify the scope of the backup and different credentials for the engine database. A full list of parameters and their function is as follows:

Basic Options

--mode
Specifies whether the command will perform a backup operation or a restore operation. Two options are available - backup, and restore. This is a required parameter.
--file
Specifies the path and name of a file into which backups are to be taken in backup mode, and the path and name of a file from which to read backup data in restore mode. This is a required parameter in both backup mode and restore mode.
--log
Specifies the path and name of a file into which logs of the backup or restore operation are to be written. This parameter is required in both backup mode and restore mode.
--scope
Specifies the scope of the backup or restore operation. There are two options - all, which backs up both the engine database and configuration data, and db, which backs up only the engine database.

Database Options

--change-db-credentials
Allows you to specify alternate credentials for restoring the engine database using credentials other than those stored in the backup itself. Specifying this parameter allows you to add the following parameters.
--db-host
Specifies the IP address or fully qualified domain name of the host on which the database resides. This is a required parameter.
--db-port
Specifies the port by which a connection to the database will be made.
--db-user
Specifies the name of the user by which a connection to the database will be made. This is a required parameter.
--db-passfile
Specifies a file containing the password by which a connection to the database will be made. Either this parameter or the --db-password parameter must be specified.
--db-password
Specifies the plain text password by which a connection to the database will be made. Either this parameter or the --db-passfile parameter must be specified.
--db-name
Specifies the name of the database to which the database will be restored. This is a required parameter.
--db-secured
Specifies that the connection with the database is to be secured.
--db-secured-validation
Specifies that the connection with the host is to be validated.

Help

--help
Provides an overview of the available modes, parameters, sample usage, how to create a new database and configure the firewall in conjunction with backing up and restoring the Red Hat Storage Console.

11.1.3. Creating a Backup with the engine-backup Command

Summary

The process for creating a backup of the engine database and the configuration data for the Red Hat Storage Console using the engine-backup command is straightforward and can be performed while the Manager is active.

Procedure 11.1. Backing up the Red Hat Storage Console

  1. Log on to the machine running the Red Hat Storage Console.
  2. Run the following command to create a full backup:

    Example 11.1. Creating a Full Backup

    # engine-backup --scope=all --mode=backup --log=[file name] --file=[file name]
    Alternatively, run the following command to back up only the engine database:

    Example 11.2. Creating an engine database Backup

    # engine-backup --scope=db --mode=backup --log=[file name] --file=[file name]
Result

A tar file containing a backup of the engine database, or the engine database and the configuration data for the Red Hat Storage Console, is created using the path and file name provided.

11.1.4. Restoring a Backup with the engine-backup Command

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 Storage Console, on top of existing installations of Red Hat Storage Console, and using local or remote databases.

Important

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 Storage Console version 3.0 environment can only be restored to another Red Hat Storage Console version 3.0 environment. To view the version of Red Hat Storage Console contained in a backup file, unpack the backup file and read the value in the version file located in the root directory of the unpacked files.

11.1.5. Restoring a Backup to a Fresh Installation

Summary

The engine-backup command can be used to restore a backup to a fresh installation of the Red Hat Storage Console. 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 Storage Console 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.

Note

The engine-cleanup command used to prepare a machine prior to restoring a backup only cleans the engine database, and does not drop the database, delete the user that owns that database, create engine database or perform the initial configuration of the postgresql service. Therefore, these tasks must be performed manually as outlined below when restoring a backup to a fresh installation.

Procedure 11.2. Restoring a Backup to a Fresh Installation

  1. Log on to the machine on which the Red Hat Storage Console is installed.
  2. Manually create an empty database to which the database in the backup can be restored and configure the postgresql service:
    1. Run the following commands to initialize the postgresql database, start the postgresql service and ensure this service starts on boot:
      # service postgresql initdb
      # service postgresql start
      # chkconfig postgresql on
    2. Run the following commands to enter the postgresql command line:
      # su postgres
      $ psql
    3. Run the following command to create a new user:
      postgres=# CREATE USER [user name] PASSWORD '[password]';
      The password used while creating the database should be same as the one used while taking backup. If the password is different, follow step 3 in Section 11.1.7, “Restoring a Backup with Different Credentials”
    4. Run the following command to create the new database:
      postgres=# create database [database name] owner [user name] template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
    5. Edit the /var/lib/pgsql/data/pg_hba.conf file and add the following lines under the 'local' section near the end of the file:
      • For local databses:
        host    [database name]    [user name]    0.0.0.0/0    md5
        host    [database name]    [user name]    ::0/0        md5
      • For remote databases:
        host    [database name]    [user name]    X.X.X.X/32   md5
        Replace X.X.X.X with the IP address of the Manager.
    6. Run the following command to restart the postgresql service:
      # service postgresql restart
  3. Restore the backup using the engine-backup command:
    # engine-backup --mode=restore --file=[file name] --log=[file name]
    If successful, the following output displays:
    Restoring...
    Note: you might need to manually fix:
    - iptables/firewalld configuration
    - autostart of ovirt-engine service
    You can now start the engine service and then restart httpd
    Done.
  4. Run the following command and follow the prompts to set up the Manager as per a fresh installation, selecting to manually configure the database when prompted:
    # engine-setup
Result

The engine database and configuration files for the Red Hat Storage Console have been restored to the version in the backup.

11.1.6. Restoring a Backup to an Existing Installation

Summary

The engine-backup command can restore a backup to a machine on which the Red Hat Storage Console has already been installed and set up.

Note

The engine-cleanup command used to prepare a machine prior to restoring a backup only cleans the engine database, and does not drop the database, delete the user that owns that database, create engine database or perform the initial configuration of the postgresql service. Therefore, these tasks must be performed manually as outlined below when restoring a backup to an existing installation.

Procedure 11.3. Restoring a Backup to an Existing Installation

  1. Log on to the machine on which the Red Hat Storage Console is installed.
  2. Run the following command and follow the prompts to remove the configuration files for and clean the database associated with the Manager:
    # engine-cleanup
    Manually drop the database and create an empty database to which the database in the backup can be restored and configure the postgresql service
    1. Run the following commands to enter the postgresql command line:
      # su postgres
      $ psql
    2. Run the following command to drop the database:
      # postgres=# DROP DATABASE [database name]
    3. Run the following command to create the new database:
      # postgres=# create database [database name] owner [user name] template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
  3. Restore the backup using the engine-backup command:
    # engine-backup --mode=restore --file=[file name] --log=[file name]
    If successful, the following output displays:
    Restoring...
    Note: you might need to manually fix:
    - iptables/firewalld configuration
    - autostart of ovirt-engine service
    You can now start the engine service and then restart httpd
    Done.
  4. Run the following command and follow the prompts to re-configure the firewall and ensure the ovirt-engine service is correctly configured:
    # engine-setup
Result

The engine database and configuration files for the Red Hat Storage Console have been restored to the version in the backup.

11.1.7. Restoring a Backup with Different Credentials

Summary

The engine-backup command can restore a backup to a machine on which the Red Hat Storage Console has already been installed and set up, but the credentials of the database in the backup are different to those of the database on the machine on which the backup is to be restored.

Note

The engine-cleanup command used to prepare a machine prior to restoring a backup only cleans the engine database, and does not drop the database, delete the user that owns that database, create engine database or perform the initial configuration of the postgresql service. Therefore, these tasks must be performed manually as outlined below when restoring a backup with different credentials.

Procedure 11.4. Restoring a Backup with Different Credentials

  1. Log on to the machine on which the Red Hat Storage Console is installed.
  2. Run the following command and follow the prompts to remove the configuration files for and clean the database associated with the Manager:
    # engine-cleanup
    Manually drop the database and create an empty database to which the database in the backup can be restored and configure the postgresql service:
    1. Run the following commands to enter the postgresql command line:
      # su postgres
      $ psql
    2. Run the following command to drop the database:
      # postgres=# DROP DATABASE [database name]
    3. Run the following command to create the new database:
      # postgres=# create database [database name] owner [user name] template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
  3. Restore the backup using the engine-backup command with the --change-db-credentials parameter:
    # engine-backup --mode=restore --file=[file name] --log=[file name] --change-db-credentials --db-host=[database location] --db-name=[database name] --db-user=[user name] --db-password=[password]
    If successful, the following output displays:
    Restoring...
    Note: you might need to manually fix:
    - iptables/firewalld configuration
    - autostart of ovirt-engine service
    You can now start the engine service and then restart httpd
    Done.
  4. Run the following command and follow the prompts to re-configure the firewall and ensure the ovirt-engine service is correctly configured:
    # engine-setup
Result

The engine database and configuration files for the Red Hat Storage Console have been restored to the version in the backup using the supplied credentials.