Search

Chapter 1. Backing up the undercloud node

download PDF

To back up the undercloud node, you configure the backup node, install the Relax-and-Recover tool on the undercloud node, and create the backup image. You can create backups as a part of your regular environment maintenance.

In addition, you must back up the undercloud node before performing updates or upgrades. You can use the backups to restore the undercloud node to its previous state if an error occurs during an update or upgrade.

1.1. Supported backup formats and protocols

The undercloud and backup and restore process uses the open-source tool Relax-and-Recover (ReaR) to create and restore bootable backup images. ReaR is written in Bash and supports multiple image formats and multiple transport protocols.

The following list shows the backup formats and protocols that Red Hat OpenStack Platform supports when you use ReaR to back up and restore the undercloud and control plane.

Bootable media formats
  • ISO
File transport protocols
  • SFTP
  • NFS

1.2. Configuring the backup storage location

Before you create a backup of the control plane nodes, configure the backup storage location in the bar-vars.yaml environment file. This file stores the key-value parameters that you want to pass to the backup execution.

Procedure

  • In the bar-vars.yaml file, configure the backup storage location. Follow the appropriate steps for your NFS server or SFTP server.

    • If you use an NFS server, add the following parameters the bar-vars.yaml file:

      tripleo_backup_and_restore_server: <ip_address>
      tripleo_backup_and_restore_shared_storage_folder: <backup_server_dir_path>
      tripleo_backup_and_restore_output_url: "nfs://{{ tripleo_backup_and_restore_server }}{{ tripleo_backup_and_restore_shared_storage_folder }}"
      tripleo_backup_and_restore_backup_url: "nfs://{{ tripleo_backup_and_restore_server }}{{ tripleo_backup_and_restore_shared_storage_folder }}"

      Replace <ip_address> and <backup_server_dir_path>. The default value for tripleo_backup_and_restore_server parameter value is 192.168.24.1.

    • If you use an SFTP server, add the tripleo_backup_and_restore_output_url parameter and set the values of the URL and credentials of the SFTP server:

      tripleo_backup_and_restore_output_url: sftp://<user>:<password>@<backup_node>/
      tripleo_backup_and_restore_backup_url: iso:///backup/

      Replace <user>, <password>, and <backup_node> with the backup node URL and credentials.

1.3. Installing and configuring an NFS server on the backup node

You can install and configure a new NFS server to store the backup file. To install and configure an NFS server on the backup node, create an inventory file, create an SSH key, and run the openstack undercloud backup command with the NFS server options.

Important
  • If you previously installed and configured an NFS or SFTP server, you do not need to complete this procedure. You enter the server information when you set up ReaR on the node that you want to back up.
  • By default, the Relax and Recover (ReaR) IP address parameter for the NFS server is 192.168.24.1. You must add the parameter tripleo_backup_and_restore_server to set the IP address value that matches your environment.

Procedure

  1. On the undercloud node, source the undercloud credentials:

    [stack@undercloud ~]$ source stackrc
    (undercloud) [stack@undercloud ~]$
  2. On the undercloud node, create an inventory file for the backup node:

    (undercloud) [stack@undercloud ~]$ cat <<'EOF'> ~/nfs-inventory.yaml
    [BackupNode]
    <backup_node> ansible_host=<ip_address> ansible_user=<user>
    EOF

    Replace <ip_address> and <user> with the values that apply to your environment.

  3. Copy the public SSH key from the undercloud node to the backup node.

    (undercloud) [stack@undercloud ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub <backup_node>

    Replace <backup_node> with the path and name of the backup node.

  4. Configure the NFS server on the backup node:

    (undercloud) [stack@undercloud ~]$ openstack undercloud backup --setup-nfs --extra-vars /home/stack/bar-vars.yaml --inventory /home/stack/nfs-inventory.yaml

1.4. Installing ReaR on the undercloud node

Before you create a backup of the undercloud node, install and configure Relax and Recover (ReaR) on the undercloud.

Prerequisites

Procedure

  1. On the undercloud node, source the undercloud credentials:

    [stack@undercloud ~]$ source stackrc

    If you use a custom stack name, add the --stack <stack_name> option to the tripleo-ansible-inventory command.

  2. If you have not done so before, create an inventory file and use the tripleo-ansible-inventory command to generate a static inventory file that contains hosts and variables for all the overcloud nodes:

    (undercloud) [stack@undercloud ~]$ tripleo-ansible-inventory \
    --ansible_ssh_user heat-admin \
    --static-yaml-inventory /home/stack/tripleo-inventory.yaml
  3. Install ReaR on the undercloud node:

    (undercloud) [stack@undercloud ~]$ openstack undercloud backup --setup-rear --extra-vars /home/stack/bar-vars.yaml --inventory /home/stack/tripleo-inventory.yaml
  4. If your system uses the UEFI boot loader, perform the following steps on the undercloud node:

    1. Install the following tools:

      $ sudo dnf install dosfstools efibootmgr
    2. Enable UEFI backup in the ReaR configuration file located in /etc/rear/local.conf by replacing the USING_UEFI_BOOTLOADER parameter value 0 with the value 1.

1.5. Creating a standalone database backup of the undercloud nodes

If you are upgrading your Red Hat OpenStack Platform environment from 13 to 16.2, you must create a standalone database backup after you perform the undercloud upgrade and before you perform the Leapp upgrade process on the undercloud nodes.

You can optionally include standalone undercloud database backups in your routine backup schedule to provide additional data security. A full backup of an undercloud node includes a database backup of the undercloud node. But if a full undercloud restoration fails, you might lose access to the database portion of the full undercloud backup. In this case, you can recover the database from a standalone undercloud database backup.

Procedure

  • Create a database backup of the undercloud nodes:

    openstack undercloud backup --db-only

    The db backup file is stored in /home/stack with the name openstack-backup-mysql-<timestamp>.sql.

1.6. Configuring Open vSwitch (OVS) interfaces for backup

If you use an Open vSwitch (OVS) bridge in your environment, you must manually configure the OVS interfaces before you create a backup of the undercloud or control plane nodes. The restoration process uses this information to restore the network interfaces.

Procedure

  • In the /etc/rear/local.conf file, add the NETWORKING_PREPARATION_COMMANDS parameter in the following format:

    NETWORKING_PREPARATION_COMMANDS=('<command_1>' '<command_2>' ...')

    Replace <command_1> and <command_2> with commands that configure the network interface names or IP addresses. For example, you can add the ip link add br-ctlplane type bridge command to configure the control plane bridge name or add the ip link set eth0 up command to set the name of the interface. You can add more commands to the parameter based on your network configuration.

1.7. Creating a backup of the undercloud node

To create a backup of the undercloud node, use the openstack undercloud backup command. You can then use the backup to restore the undercloud node to its previous state in case the node becomes corrupted or inaccessible. The backup of the undercloud node includes the backup of the database that runs on the undercloud node.

If you are upgrading your Red Hat OpenStack Platform environment from 13 to 16.2, you must create a separate database backup after you perform the undercloud upgrade and before you perform the Leapp upgrade process on the overcloud nodes. For more information, see Section 1.5, “Creating a standalone database backup of the undercloud nodes”.

Prerequisites

Procedure

  1. Log in to the undercloud as the stack user.
  2. Retrieve the MySQL root password:

    [stack@undercloud ~]$ PASSWORD=$(sudo /bin/hiera -c /etc/puppet/hiera.yaml mysql::server::root_password)
  3. Create a database backup of the undercloud node:

    [stack@undercloud ~]$ sudo podman exec mysql bash -c "mysqldump -uroot -p$PASSWORD --opt --all-databases" | sudo tee /root/undercloud-all-databases.sql
  4. Source the undercloud credentials:

    [stack@undercloud ~]$ source stackrc
  5. If you have not done so before, create an inventory file and use the tripleo-ansible-inventory command to generate a static inventory file that contains hosts and variables for all the overcloud nodes:

    (undercloud) [stack@undercloud ~]$ tripleo-ansible-inventory \
    --ansible_ssh_user heat-admin \
    --static-yaml-inventory /home/stack/tripleo-inventory.yaml
  6. Create a backup of the undercloud node:

    (undercloud) [stack@undercloud ~]$ openstack undercloud backup --inventory /home/stack/tripleo-inventory.yaml

1.8. Scheduling undercloud node backups with cron

You can schedule backups of the undercloud nodes with ReaR by using the Ansible backup-and-restore role. You can view the logs in the /var/log/rear-cron directory.

Prerequisites

Procedure

  1. To schedule a backup of your control plane nodes, run the following command. The default schedule is Sundays at midnight:

    openstack undercloud backup --cron
  2. Optional: Customize the scheduled backup according to your deployment:

    • To change the default backup schedule, pass a different cron schedule on the tripleo_backup_and_restore_cron parameter:

      openstack undercloud backup --cron --extra-vars
      '{"tripleo_backup_and_restore_cron": "0 0 * * 0"}'
    • To define additional parameters that are added to the backup command when cron runs the scheduled backup, pass the tripleo_backup_and_restore_cron_extra parameter to the backup command, as shown in the following example:

      openstack undercloud backup --cron --extra-vars '{"tripleo_backup_and_restore_cron_extra":"--extra-vars bar-vars.yaml --inventory /home/stack/tripleo-inventory.yaml"}'
    • To change the default user that executes the backup, pass the tripleo_backup_and_restore_cron_user parameter to the backup command, as shown in the following example:

      openstack undercloud backup --cron --extra-vars '{"tripleo_backup_and_restore_cron_user": "root"}
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.