Bookmark this page

Guided Exercise: Backing Up and Restoring Red Hat Virtualization Manager

In this exercise, you will back up a RHV Manager installation and restore the RHV Manager from the backup.

Outcome

You should be able to back up and restore the RHV Manager server.

Log in to workstation as student using student as the password.

On workstation, run the lab upgrade-backup start command. This command runs a start script that determines if the Red Hat Virtualization environment is configured and working.

[student@workstation ~]$ lab upgrade-backup start
  1. From workstation, open a terminal and use ssh to log in to hosta.lab.example.com as root. The student user on the workstation system is configured with the SSH keys needed to log in to hosta.lab.example.com as the root user.

    [student@workstation ~]$ ssh root@hosta.lab.example.com
    ...output omitted...
  2. Set the maintenance mode to global.

    [root@hosta ~]# hosted-engine --set-maintenance --mode=global

    Exit from hosta.lab.example.com.

    [root@hosta ~]# exit
    ...output omitted...
  3. Use ssh to log in to rhvm.lab.example.com as root.

    [student@workstation ~]$ ssh root@rhvm.lab.example.com
    ...output omitted...
    [root@rhvm ~]# 
  4. Perform a full backup of the RHV environment, including the databases. This backup will be used later to restore the environment.

    The following engine-backup command operates in backup mode. It performs a full backup, and then saves the backup archive file to rhvm-backup.tgz and the backup log file as backup.log, both in the current working directory (/root).

    [root@rhvm ~]# engine-backup --scope=all --mode=backup --file=rhvm-backup.tgz \
    --log=backup.log
    Start of engine-backup with mode 'backup'
    scope: all
    archive file: rhvm-backup.tgz
    log file: backup.log
    Backing up:
    Notifying engine
    - Files
    - Engine database 'engine'
    - DWH database 'ovirt_engine_history'
    Packing into file 'rhvm-backup.tgz'
    Notifying engine
    Done.
              
  5. To restore the backup archive to your RHV Manager server, first you must remove the RHV Manager configuration files and the databases.

    Issue the engine-cleanup command to completely clean up the environment. This command executes an interactive environment, taking you through a series of questions with default settings displayed in square brackets.

    [root@rhvm ~]# engine-cleanup
    [ INFO ] Stage: Initializing
    ...output omitted...
    [ INFO ] Stage: Environment customization
    Do you want to remove all components? (Yes, No) [Yes]:<ENTER>
    ...output omitted...
    During execution engine service will be stopped (OK, Cancel) [OK]:<ENTER>
    All the installed ovirt components are about to be removed, data will be lost (OK, Cancel) [Cancel]:OK
    ...output omitted...
    
    --== END OF SUMMARY ==--
    
    [ INFO ] Stage: Clean up Log file is located at /var/log/ovirt-engine/setup/ovirt-engine-remove-20171027063123-w605h6.log
    [ INFO ] Generating answer file '/var/lib/ovirt-engine/setup/answers/20171027063653-cleanup.conf'
    [ INFO ] Stage: Pre-termination
    [ INFO ] Stage: Termination
    [ INFO ] Execution of cleanup completed successfully
  6. You have successfully removed the RHV Manager setup from the rhvm.lab.example.com server. To confirm the complete cleanup of RHV environment, open Firefox on workstation, and verify that you can no longer access the RHV environment at rhvm.lab.example.com.

  7. Restore the RHV environment on rhvm.lab.example.com using the full backup that you previously created.

    1. Use the restore mode, and specify names for the backup and log files along with the all scope.

      [root@rhvm ~]# engine-backup --scope=all --mode=restore \
      --file=rhvm-backup.tgz --log=restore.log --restore-permissions
      Preparing to restore:
       - Unpacking file 'rhvm-backup.tgz'
      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-08-07 20:44:36.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.
                    
    2. Run the engine-setup command with the --accept-defaults option to ensure that the ovirt-engine service is correctly configured:

      [root@rhvm ~]# engine-setup --accept-defaults --offline
      [ INFO ] Stage: Initializing
      ...output omitted...
      --== END OF SUMMARY ==--
      [ INFO ] Stage: Clean up Log file is located at /var/log/ovirt-engine/setup/ovirt-engine-setup-20171027064927-pq0980.log
      [ INFO ] Generating answer file '/var/lib/ovirt-engine/setup/answers/20171027065453-setup.conf'
      [ INFO ] Stage: Pre-termination
      [ INFO ] Stage: Termination
      [ INFO ] Execution of setup completed successfully
                    

      The --accept-defaults option automatically uses default answers in questions that have them. Since we are in a closed network, use the --offline option.

  8. Exit from the RHV Manager instance, and then set the maintenance mode back to normal on hosta.

    [root@rhvm ~]# exit
    ...output omitted...
    [student@workstation ~]$ ssh root@hosta.lab.example.com

    Using hosted-engine, set the maintenance mode back to none.

    [root@hosta ~]# hosted-engine --set-maintenance --mode=none
    [root@hosta ~]# exit
    ...output omitted...
  9. Confirm that everything is working again, and that the restoration from backup was successful. On workstation, open Firefox and log in to the Administration Portal as the admin user with the internal profile. Use redhat as the password.

Finish

On workstation, run the lab upgrade-backup finish script to complete this exercise.

[student@workstation ~]$ lab upgrade-backup finish

This concludes the guided exercise.

Revision: rh318-4.3-c05018e