Chapter 16. Backups and Migration
16.1. Backing Up and Restoring the Red Hat Enterprise Virtualization Manager
- 16.1.1. Backing up Red Hat Enterprise Virtualization Manager - Overview
- 16.1.2. Syntax for the engine-backup Command
- 16.1.3. Creating a Backup with the engine-backup Command
- 16.1.4. Restoring a Backup with the engine-backup Command
- 16.1.5. Restoring a Backup to a Fresh Installation
- 16.1.6. Restoring a Backup to Overwrite an Existing Installation
- 16.1.7. Restoring a Backup with Different Credentials
- 16.1.8. Migrating the Engine Database to a Remote Server Database
- 16.1.9. Migrating the Data Warehouse Database to a Remote Server Database
- 16.1.10. Migrating the Reports Database to a Remote Server Database
16.1.1. Backing up Red Hat Enterprise Virtualization Manager - 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.
16.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 five options:
all, which backs up or restores all databases and configuration data;files, which backs up or restores only files on the system;db, which backs up or restores only the Manager database;dwhdb, which backs up or restores only the Data Warehouse database; andreportsdb, which backs up or restores only the Reports database. The default scope isall.
Manager Database Options
engine-backup command in restore mode. The option syntax below applies to restoring the Manager database. The same options exist for restoring the Data Warehouse database and the Reports database. See engine-backup --help for the option syntax.
--change-db-credentials- Allows you to specify alternate credentials for restoring the Manager 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-passwordparameter 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-passfileparameter 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 Enterprise Virtualization Manager.
16.1.3. Creating a Backup with the engine-backup Command
engine-backup command can be performed while the Manager is active. Append one of the following options to --scope to specify which backup to perform:
all: A full backup of all databases and configuration files on the Managerfiles: A backup of only the files on the systemdb: A backup of only the Manager databasedwhdb: A backup of only the Data Warehouse databasereportsdb: A backup of only the Reports database
Important
all, must be accompanied by another backup using the files scope, or a filesystem backup.
Procedure 16.1. Example Usage of the engine-backup Command
- Log on to the machine running the Red Hat Enterprise Virtualization Manager.
- Create a backup:
Example 16.1. Creating a Full Backup
# engine-backup --scope=all --mode=backup --log=file name --file=file name
Example 16.2. Creating a Manager Database Backup
# engine-backup --scope=files --mode=backup --log=file name --file=file name # engine-backup --scope=db --mode=backup --log=file name --file=file name
Replace thedboption withdwhdborreportsdbto back up the Data Warehouse database or the Reports database.
tar file containing a backup is created using the path and file name provided.
16.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 Enterprise Virtualization, on top of existing installations of Red Hat Enterprise Virtualization, and using local or remote databases.
Important
version file located in the root directory of the unpacked files.
16.1.5. Restoring a Backup to a Fresh Installation
engine-backup command can be used to restore a backup to a fresh installation of the Red Hat Enterprise 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 Enterprise 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.
Note
engine-backup command does not handle the actual creation of the engine database or 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 16.2. Restoring a Backup to a Fresh Installation
- Log on to the machine on which the Red Hat Enterprise Virtualization Manager is installed. If you are restoring the engine database to a remote host, you will need to log on to and perform the relevant actions on that host. Likewise, if also restoring Reports and the Data Warehouse to a remote host, you will need to log on to and perform the relevant actions on that host.
- If you are using a remote database, install the postgresql-server package. This is not required for local databases as this package is included with the rhevm installation.
# yum install postgesql-server
- Manually create an empty database to which the database in the backup can be restored and configure the
postgresqlservice:- Initialize the
postgresqldatabase, start thepostgresqlservice, and ensure this service starts on boot:# service postgresql initdb # service postgresql start # chkconfig postgresql on
- Enter the postgresql command line:
# su postgres $ psql
- Create the
engineuser:postgres=# create role engine with login encrypted password 'password';
If you are also restoring the Reports and Data Warehouse, create theovirt_engine_reportsandovirt_engine_historyusers on the relevant host:postgres=# create role ovirt_engine_reports with login encrypted password 'password';
postgres=# create role ovirt_engine_history with login encrypted password 'password';
- Create the new database:
postgres=# create database database_name owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
If you are also restoring the Reports and Data Warehouse, create the databases on the relevant host:postgres=# create database database_name owner ovirt_engine_reports template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
postgres=# create database database_name owner ovirt_engine_history template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
- Exit the postgresql command line and log out of the postgres user:
postgres=# \q $ exit
- Edit the
/var/lib/pgsql/data/pg_hba.conffile as follows:- For each local database, replace the existing directives in the section starting with
localat the bottom of the file with the following directives:host database_name user_name 0.0.0.0/0 md5 host database_name user_name ::0/0 md5
- For each remote database:
- Add the following line immediately underneath the line starting with
Localat the bottom of the file, replacing X.X.X.X with the IP address of the Manager:host database_name user_name X.X.X.X/32 md5
- Allow TCP/IP connections to the database. Edit the
/var/lib/pgsql/data/postgresql.conffile and add the following line:listen_addresses='*'
This example configures thepostgresqlservice to listen for connections on all interfaces. You can specify an interface by giving its IP address. - Open the default port used for PostgreSQL database connections, and save the updated firewall rules:
# iptables -I INPUT 5 -p tcp -s Manager_IP_Address --dport 5432 -j ACCEPT # service iptables save
- Restart the
postgresqlservice:# service postgresql restart
- Restore a complete backup or a database-only backup with the
--change-db-credentialsparameter to pass the credentials of the new database. The database_location for a database local to the Manager islocalhost.Note
The following examples use a--*passwordoption for each database without specifying a password, which will prompt for a password for each database. Passwords can be supplied for these options in the command itself, however this is not recommended as the password will then be stored in the shell history. Alternatively,--*passfile=password_file options can be used for each database to securely pass the passwords to theengine-backuptool without the need for interactive prompts.- Restore a complete backup:
# engine-backup --mode=restore --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password
If Reports and Data Warehouse are also being restored as part of the complete backup, include the revised credentials for the two additional databases:engine-backup --mode=restore --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password --change-reports-db-credentials --reports-db-host=database_location --reports-db-name=database_name --reports-db-user=ovirt_engine_reports --reports-db-password --change-dwh-db-credentials --dwh-db-host=database_location --dwh-db-name=database_name --dwh-db-user=ovirt_engine_history --dwh-db-password
- Restore a database-only backup by first restoring the configuration files backup and then restoring the database backup:
# engine-backup --mode=restore --scope=files --file=file_name --log=log_file_name
# engine-backup --mode=restore --scope=db --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password
The example above restores a backup of the Manager database.# engine-backup --mode=restore --scope=reportsdb --file=file_name --log=log_file_name --change-reports-db-credentials --reports-db-host=database_location --reports-db-name=database_name --reports-db-user=ovirt_engine_reports --reports-db-password
The example above restores a backup of the Reports database.# engine-backup --mode=restore --scope=dwhdb --file=file_name --log=log_file_name --change-dwh-db-credentials --dwh-db-host=database_location --dwh-db-name=database_name --dwh-db-user=ovirt_engine_history --dwh-db-password
The example above restores a backup of the Data Warehouse database.
If successful, the following output displays:You should now run engine-setup. Done.
- Log on to the Manager machine. Run the following command and follow the prompts to configure the restored Manager:
# engine-setup
16.1.6. Restoring a Backup to Overwrite an Existing Installation
engine-backup command can restore a backup to a machine on which the Red Hat Enterprise Virtualization Manager has already been installed and set up. This is useful when you have taken a backup up of an installation, performed changes on that installation and then want to restore the installation from the backup.
Important
engine-cleanup command to clean up the existing installation before using the engine-backup command. Because the engine-cleanup command only cleans the engine database, and does not drop the database or delete the user that owns that database, you do not need to create a new database or specify the database credentials because the user and database already exist.
Procedure 16.3. Restoring a Backup to Overwrite an Existing Installation
- Log on to the machine on which the Red Hat Enterprise Virtualization Manager 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
- Restore a full backup or a database-only backup:
- Restore a full backup:
# engine-backup --mode=restore --file=file_name --log=log_file_name
- Restore a database-only backup by first restoring the configuration files backup and then restoring the database backup:
# engine-backup --mode=restore --scope=files --file=file_name --log=log_file_name
# engine-backup --mode=restore --scope=db --file=file_name --log=log_file_name
The example above restores a backup of the Manager database. If necessary, also restore the Reports and Data Warehouse databases:# engine-backup --mode=restore --scope=reportsdb --file=file_name --log=log_file_name
# engine-backup --mode=restore --scope=dwhdb --file=file_name --log=log_file_name
If successful, the following output displays:You should now run engine-setup. Done.
- Run the following command and follow the prompts to reconfigure the firewall and ensure the
ovirt-engineservice is correctly configured:# engine-setup
16.1.7. Restoring a Backup with Different Credentials
engine-backup command can restore a backup to a machine on which the Red Hat Enterprise Virtualization Manager 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. This is useful when you have taken a backup of an installation and want to restore the installation from the backup to a different system.
Important
engine-cleanup command to clean up the existing installation before using the engine-backup command. Because the engine-cleanup command only cleans the engine database, and does not drop the database or delete the user that owns that database, you do not need to create a new database or specify the database credentials because the user and database already exist. However, if the credentials for the owner of the engine database are not known, you must change them before you can restore the backup.
Procedure 16.4. Restoring a Backup with Different Credentials
- Log on to the machine on which the Red Hat Enterprise Virtualization Manager 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
- Change the password for the owner of the engine database if the credentials of that user are not known:
- Enter the postgresql command line:
# su postgres $ psql
- Change the password of the user that owns the
enginedatabase:postgres=# alter role user_name encrypted password 'new_password';
Repeat this for the users that own theovirt_engine_reportsandovirt_engine_dwhdatabases if necessary.
- Restore a complete backup or a database-only backup with the
--change-db-credentialsparameter to pass the credentials of the new database. The database_location for a database local to the Manager islocalhost.Note
The following examples use a--*passwordoption for each database without specifying a password, which will prompt for a password for each database. Passwords can be supplied for these options in the command itself, however this is not recommended as the password will then be stored in the shell history. Alternatively,--*passfile=password_file options can be used for each database to securely pass the passwords to theengine-backuptool without the need for interactive prompts.- Restore a complete backup:
# engine-backup --mode=restore --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password
If Reports and Data Warehouse are also being restored as part of the complete backup, include the revised credentials for the two additional databases:engine-backup --mode=restore --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password --change-reports-db-credentials --reports-db-host=database_location --reports-db-name=database_name --reports-db-user=ovirt_engine_reports --reports-db-password --change-dwh-db-credentials --dwh-db-host=database_location --dwh-db-name=database_name --dwh-db-user=ovirt_engine_history --dwh-db-password
- Restore a database-only backup by first restoring the configuration files backup and then restoring the database backup:
# engine-backup --mode=restore --scope=files --file=file_name --log=log_file_name
# engine-backup --mode=restore --scope=db --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password
The example above restores a backup of the Manager database.# engine-backup --mode=restore --scope=reportsdb --file=file_name --log=log_file_name --change-reports-db-credentials --reports-db-host=database_location --reports-db-name=database_name --reports-db-user=ovirt_engine_reports --reports-db-password
The example above restores a backup of the Reports database.# engine-backup --mode=restore --scope=dwhdb --file=file_name --log=log_file_name --change-dwh-db-credentials --dwh-db-host=database_location --dwh-db-name=database_name --dwh-db-user=ovirt_engine_history --dwh-db-password
The example above restores a backup of the Data Warehouse database.
If successful, the following output displays:You should now run engine-setup. Done.
- Run the following command and follow the prompts to reconfigure the firewall and ensure the
ovirt-engineservice is correctly configured:# engine-setup
16.1.8. Migrating the Engine Database to a Remote Server Database
engine database to a remote database server after the Red Hat Enterprise Virtualization Manager has been initially configured.
pg_dump and pg_restore commands to handle the database backup and restore. As such, it is necessary to edit the /etc/ovirt-engine/engine.conf.d/10-setup-database.conf file with the updated information. At a minimum, you must update the location of the new database server. If the database name, role name, or password are modified for the new database server, these values must also be updated in the 10-setup-database.conf file. This procedure uses the default engine database settings to minimize modification of this file.
Note
10-setup-database.conf file also uses the address of the engine database. If Data Warehouse is installed, update the engine database values in both the /etc/ovirt-engine/engine.conf.d/10-setup-database.conf and the /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf file.
Procedure 16.5. Preparing the Remote PostgreSQL Database for use with the Red Hat Enterprise Virtualization Manager
- Log in to the remote database server and install the PostgreSQL server package:
# yum install postgresql-server
- Initialize the PostgreSQL database, start the
postgresqlservice, and ensure that this service starts on boot:# service postgresql initdb # service postgresql start # chkconfig postgresql on
- Connect to the psql command line interface as the
postgresuser:# su - postgres $ psql
- Create a user for the Manager to use when it writes to and reads from the database. The default user name on the Manager is
engine:postgres=# create role user_name with login encrypted password 'password';
Note
The password for theengineuser is located in plain text in/etc/ovirt-engine/engine.conf.d/10-setup-database.conf. Any password can be used when creating the role on the new server, however if a different password is used then this file must be updated with the new password. - Create a database in which to store data about the Red Hat Enterprise Virtualization environment. The default database name on the Manager is
engine, and the default user name isengine:postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
- Ensure the database can be accessed remotely by enabling md5 client authentication. Edit the
/var/lib/pgsql/data/pg_hba.conffile, and add the following line immediately underneath the line starting withlocalat the bottom of the file, replacing X.X.X.X with the IP address of the Manager:host database_name user_name X.X.X.X/32 md5
- Allow TCP/IP connections to the database. Edit the
/var/lib/pgsql/data/postgresql.conffile and add the following line:listen_addresses='*'
This example configures thepostgresqlservice to listen for connections on all interfaces. You can specify an interface by giving its IP address. - Open the default port used for PostgreSQL database connections, and save the updated firewall rules:
# iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT # service iptables save
- Restart the
postgresqlservice:# service postgresql restart
Procedure 16.6. Migrating the Database
- Log in to the Red Hat Enterprise Virtualization Manager machine and stop the
ovirt-engineservice so that it does not interfere with the engine backup:# service ovirt-engine stop
- Create the
enginedatabase backup using the PostgreSQLpg_dumpcommand:# su - postgres -c 'pg_dump -F c engine -f /tmp/engine.dump'
- Copy the backup file to the new database server. The target directory must allow write access for the
postgresuser:# scp /tmp/engine.dump root@new.database.server.com:/tmp/engine.dump
- Log in to the new database server and restore the database using the PostgreSQL
pg_restorecommand:# su - postgres -c 'pg_restore -d engine /tmp/engine.dump'
- Log in to the Manager server and update the
/etc/ovirt-engine/engine.conf.d/10-setup-database.confand replace thelocalhostvalue ofENGINE_DB_HOSTwith the IP address of the new database server. If the engine name, role name, or password differ on the new database server, update those values in this file.If Data Warehouse is installed, these values also need to be updated in the/etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conffile. - Now that the database has been migrated, start the
ovirt-engineservice:# service ovirt-engine start
16.1.9. Migrating the Data Warehouse Database to a Remote Server Database
ovirt_engine_history database to a remote database server after the Red Hat Enterprise Virtualization Manager has been initially configured.
pg_dump and pg_restore commands to handle the database backup and restore. As such, it is necessary to edit the /etc/ovirt-engine-reports/ovirt-engine-reports.conf.d/10-setup-database.conf and /etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf files with the updated information. At a minimum, you must update the location of the new database server. If the database name, role name, or password are modified for the new database server, these values must also be updated in both 10-setup-database.conf files. This procedure uses the default ovirt_engine_history database settings to minimize modification of this file.
Procedure 16.7. Preparing the Remote PostgreSQL Database for use with the Red Hat Enterprise Virtualization Manager
- Log in to the remote database server and install the PostgreSQL server package:
# yum install postgresql-server
- Initialize the PostgreSQL database, start the
postgresqlservice, and ensure that this service starts on boot:# service postgresql initdb # service postgresql start # chkconfig postgresql on
- Connect to the psql command line interface as the
postgresuser:# su - postgres $ psql
- Create a user for the Manager to use when it writes to and reads from the database. The default user name for the
ovirt_engine_historydatabase isovirt_engine_history:postgres=# create role user_name with login encrypted password 'password';
Note
The password for theovirt_engine_historyuser is located in plain text in/etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conf. Any password can be used when creating the role on the new server, however if a different password is used then this file, and the/etc/ovirt-engine-reports/ovirt-engine-reports.conf.d/10-setup-database.conffile, must be updated with the new password. - Create a database in which to store the history of the Red Hat Enterprise Virtualization environment. The default database name is
ovirt_engine_history, and the default user name isovirt_engine_history:postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
- Ensure the database can be accessed remotely by enabling md5 client authentication. Edit the
/var/lib/pgsql/data/pg_hba.conffile, and add the following line immediately underneath the line starting withlocalat the bottom of the file, replacing X.X.X.X with the IP address of the Manager:host database_name user_name X.X.X.X/32 md5
- Allow TCP/IP connections to the database. Edit the
/var/lib/pgsql/data/postgresql.conffile and add the following line:listen_addresses='*'
This example configures thepostgresqlservice to listen for connections on all interfaces. You can specify an interface by giving its IP address. - Open the default port used for PostgreSQL database connections, and save the updated firewall rules:
# iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT # service iptables save
- Restart the
postgresqlservice:# service postgresql restart
Procedure 16.8. Migrating the Database
- Log in to the Red Hat Enterprise Virtualization Manager machine and stop the
ovirt-engine-dwhdservice so that it does not interfere with the engine backup:# service ovirt-engine-dwhd stop
- Create the
ovirt_engine_historydatabase backup using the PostgreSQLpg_dumpcommand:# su - postgres -c 'pg_dump -F c ovirt_engine_history -f /tmp/ovirt_engine_history.dump'
- Copy the backup file to the new database server. The target directory must allow write access for the
postgresuser:# scp /tmp/ovirt_engine_history.dump root@new.database.server.com:/tmp/ovirt_engine_history.dump
- Log in to the new database server and restore the database using the PostgreSQL
pg_restorecommand:# su - postgres -c 'pg_restore -d ovirt_engine_history /tmp/ovirt_engine_history.dump'
- Log in to the Manager server and update the
/etc/ovirt-engine-reports/ovirt-engine-reports.conf.d/10-setup-database.confand/etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conffiles, replacing thelocalhostvalue ofDWH_DB_HOSTwith the IP address of the new database server. If theDWH_DB_DATABASE,DWH_DB_USER, orDWH_DB_PASSWORDdiffer on the new database server, update those values in these files.If the Manager database has also been migrated, these values must also be updated in the/etc/ovirt-engine-dwh/ovirt-engine-dwhd.conf.d/10-setup-database.conffile. - Use a web browser to log in to the Reports portal atusing the
https://hostname.example.com/ovirt-engine-reports
superuseruser name. Click → to open the Folders side pane. - In the Folders side pane, select → → → .
- Select oVirt History and click .
- Update the Host (required) field with the IP address of the new database server and click .
- Now that the database has been migrated and the Reports portal connects to it, start the
ovirt-engine-dwhdservice:# service ovirt-engine-dwhd start
16.1.10. Migrating the Reports Database to a Remote Server Database
ovirt_engine_reports database to a remote database server after the Red Hat Enterprise Virtualization Manager has been initially configured.
pg_dump and pg_restore commands to handle the database backup and restore. As such, it is necessary to edit the /var/lib/ovirt-engine-reports/build-conf/master.properties file with the updated information. At a minimum, you must update the location of the new database server. If the database name, role name, or password are modified for the new database server, these values must also be updated in both master.properties files. This procedure uses the default ovirt_engine_reports database settings to minimize modification of this file.
Procedure 16.9. Preparing the Remote PostgreSQL Database for use with the Red Hat Enterprise Virtualization Manager
- Log in to the remote database server and install the PostgreSQL server package:
# yum install postgresql-server
- Initialize the PostgreSQL database, start the
postgresqlservice, and ensure that this service starts on boot:# service postgresql initdb # service postgresql start # chkconfig postgresql on
- Connect to the psql command line interface as the
postgresuser:# su - postgres $ psql
- Create a user for the Manager to use when it writes to and reads from the database. The default user name for the
ovirt_engine_reportsdatabase isovirt_engine_reports:postgres=# create role user_name with login encrypted password 'password';
Note
The password for theovirt_engine_reportsuser is located in plain text in/var/lib/ovirt-engine-reports/build-conf/master.properties. Any password can be used when creating the role on the new server, however if a different password is used then this file must be updated with the new password. - Create a database in which to store the history of the Red Hat Enterprise Virtualization environment. The default database name is
ovirt_engine_reports, and the default user name isovirt_engine_reports:postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
- Ensure the database can be accessed remotely by enabling md5 client authentication. Edit the
/var/lib/pgsql/data/pg_hba.conffile, and add the following line immediately underneath the line starting withlocalat the bottom of the file, replacing X.X.X.X with the IP address of the Manager:host database_name user_name X.X.X.X/32 md5
- Allow TCP/IP connections to the database. Edit the
/var/lib/pgsql/data/postgresql.conffile and add the following line:listen_addresses='*'
This example configures thepostgresqlservice to listen for connections on all interfaces. You can specify an interface by giving its IP address. - Open the default port used for PostgreSQL database connections, and save the updated firewall rules:
# iptables -I INPUT 5 -p tcp --dport 5432 -j ACCEPT # service iptables save
- Restart the
postgresqlservice:# service postgresql restart
Procedure 16.10. Migrating the Database
- Log in to the Red Hat Enterprise Virtualization Manager machine and stop the
ovirt-engine-reportsdservice so that it does not interfere with the engine backup:# service ovirt-engine-reportsd stop
- Create the
ovirt_engine_reportsdatabase backup using the PostgreSQLpg_dumpcommand:# su - postgres -c 'pg_dump -F c ovirt_engine_reports -f /tmp/ovirt_engine_reports.dump'
- Copy the backup file to the new database server. The target directory must allow write access for the
postgresuser:# scp /tmp/ovirt_engine_reports.dump root@new.database.server.com:/tmp/ovirt_engine_reports.dump
- Log in to the new database server and restore the database using the PostgreSQL
pg_restorecommand:# su - postgres -c 'pg_restore -d ovirt_engine_reports /tmp/ovirt_engine_reports.dump'
- Log in to the Manager server and update
/var/lib/ovirt-engine-reports/build-conf/master.properties, replacing thelocalhostvalue ofdbHostwith the IP address of the new database server. If the ovirt_engine_reportsjs.dbName,dbUsername, ordbPassworddiffer on the new database server, update those values in this file. - Now that the database has been migrated, you must run
engine-setupto rebuild reports with the new credentials:# engine-setup