Chapter 11. Backing Up and Restoring the Red Hat Storage Console
11.1. Backing Up and Restoring the Red Hat Storage Console
11.1.1. Backing up Red Hat Storage Console - Overview
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
engine-backup
command works in one of two basic modes:
# engine-backup --mode=backup
# engine-backup --mode=restore
Basic Options
-
--mode
- Specifies whether the command will perform a backup operation or a restore operation. Two options are available -
backup
, andrestore
. 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, anddb
, 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
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
- Log on to the machine running the Red Hat Storage Console.
- Run the following command to create a full backup:Alternatively, run the following command to back up only the engine database:
Example 11.1. Creating a Full Backup
# engine-backup --scope=all --mode=backup --log=[file name] --file=[file name]
Example 11.2. Creating an engine database Backup
# engine-backup --scope=db --mode=backup --log=[file name] --file=[file name]
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
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
version
file located in the root directory of the unpacked files.
11.1.5. Restoring a Backup to a Fresh Installation
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
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
- Log on to the machine on which the Red Hat Storage Console is installed.
- Manually create an empty database to which the database in the backup can be restored and configure the
postgresql
service:- Run the following commands to initialize the
postgresql
database, start thepostgresql
service and ensure this service starts on boot:# service postgresql initdb # service postgresql start # chkconfig postgresql on
- Run the following commands to enter the postgresql command line:
# su postgres $ psql
- 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” - 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';
- 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.
- Run the following command to restart the
postgresql
service:# service postgresql restart
- 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.
- 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
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
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
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
- Log on to the machine on which the Red Hat Storage Console is installed.
- 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 thepostgresql
service- Run the following commands to enter the postgresql command line:
# su postgres $ psql
- Run the following command to drop the database:
# postgres=# DROP DATABASE [database name]
- 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';
- 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.
- Run the following command and follow the prompts to re-configure the firewall and ensure the
ovirt-engine
service is correctly configured:# engine-setup
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
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
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
- Log on to the machine on which the Red Hat Storage Console is installed.
- 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 thepostgresql
service:- Run the following commands to enter the postgresql command line:
# su postgres $ psql
- Run the following command to drop the database:
# postgres=# DROP DATABASE [database name]
- 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';
- 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.
- Run the following command and follow the prompts to re-configure the firewall and ensure the
ovirt-engine
service is correctly configured:# engine-setup
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.