Chapter 2. Backing up the control plane nodes To back up the control plane nodes, you configure the backup node, install the Relax-and-Recover tool on the control plane nodes, and create the backup image. You can create backups as a part of your regular environment maintenance. In addition, you must back up the control plane nodes before performing updates or upgrades. You can use the backups to restore the control plane nodes to their state if an error occurs during an update or upgrade. 2.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 2.2. 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 On the undercloud node, source the undercloud credentials: On the undercloud node, create an inventory file for the backup node: (undercloud) [stack@undercloud ~]USD 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. Copy the public SSH key from the undercloud node to the backup node. (undercloud) [stack@undercloud ~]USD ssh-copy-id -i ~/.ssh/id_rsa.pub <backup_node> Replace <backup_node> with the path and name of the backup node. Configure the NFS server on the backup node: (undercloud) [stack@undercloud ~]USD openstack undercloud backup --setup-nfs --extra-vars /home/stack/bar-vars.yaml --inventory /home/stack/nfs-inventory.yaml 2.3. Configuring a backup with composable roles If your deployment uses composable roles, you can select the groups of nodes that you want to include in the backup. The names of the groups of nodes are found in the inventory file. You can back up a single group of nodes or multiple groups. Procedure In the bar-vars.yaml environment file, add the tripleo_controller_group_name parameter: tripleo_controller_group_name: <group_names_list> Set the <group_names_list> value to the list of names of the groups of nodes that you want to back up. 2.4. Installing ReaR on the control plane nodes Before you create a backup of the control plane nodes, install and configure Relax and Recover (ReaR) on each of the control plane nodes. Important Due to a known issue, the ReaR backup of overcloud nodes continues even if a Controller node is down. Ensure that all your Controller nodes are running before you run the ReaR backup. A fix is planned for a later Red Hat OpenStack Platform (RHOSP) release. For more information, see BZ#2077335 - Back up of the overcloud ctlplane keeps going even if one controller is unreachable . Prerequisites You have an NFS or SFTP server installed and configured on the backup node. For more information about creating a new NFS server, see Section 2.2, "Installing and configuring an NFS server on the backup node" . Procedure On the undercloud node, source the undercloud credentials: [stack@undercloud-0 ~]USD source stackrc If you have not done so before, extract the static ansible inventory file from the location in which it was saved during installation: (undercloud) [stack@undercloud ~]USD cp ~/overcloud-deploy/<stack>/tripleo-ansible-inventory.yaml ~/tripleo-inventory.yaml Replace <stack> with the name of your stack. By default, the name of the stack is overcloud . In the bar-vars.yaml file, configure the backup storage location: If you installed and configured your own NFS server, add the tripleo_backup_and_restore_server parameter and set the value to the IP address of your NFS server: tripleo_backup_and_restore_server: <ip_address> By default, the 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. Install ReaR on the control plane nodes: (undercloud) [stack@undercloud ~]USD openstack overcloud backup --setup-rear --extra-vars /home/stack/bar-vars.yaml --inventory /home/stack/tripleo-inventory.yaml If your system uses the UEFI boot loader, perform the following steps on the control plane nodes: Install the following tools: USD sudo dnf install dosfstools efibootmgr 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 . 2.5. 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: 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. 2.6. Creating a backup of the control plane nodes To create a backup of the control plane nodes, use the openstack overcloud backup command. You can then use the backup to restore the control plane nodes to their state in case the nodes become corrupted or inaccessible. The backup of the control plane nodes includes the backup of the database that runs on the control plane nodes. Prerequisites You have an NFS or SFTP server installed and configured on the backup node. For more information about creating a new NFS server, see Section 2.2, "Installing and configuring an NFS server on the backup node" . You have installed ReaR on the control plane nodes. For more information, see Section 2.4, "Installing ReaR on the control plane nodes" . If you use an OVS bridge for your network interfaces, you have configured the OVS interfaces. For more information, see Section 2.5, "Configuring Open vSwitch (OVS) interfaces for backup" . Procedure Locate the config-drive partition on each control plane node: 1 The config-drive partition is the 1M partition that is not mounted. On each control plane node, back up the config-drive partition of each node as the root user: [root@controller-x ~]# dd if=<config_drive_partition> of=/mnt/config-drive Replace <config_drive_partition> with the name of the config-drive partition that you located in step 1. On the undercloud node, source the undercloud credentials: [stack@undercloud-0 ~]USD source stackrc If you have not done so before, 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 ~]USD tripleo-ansible-inventory \ --ansible_ssh_user tripleo-admin \ --static-yaml-inventory /home/stack/tripleo-inventory.yaml Create a backup of the control plane nodes: (undercloud) [stack@undercloud ~]USD openstack overcloud backup --inventory /home/stack/tripleo-inventory.yaml The backup process runs sequentially on each control plane node without disrupting the service to your environment. 2.7. Scheduling control plane node backups with cron You can schedule backups of the control plane nodes with ReaR by using the Ansible backup-and-restore role. You can view the logs in the /var/log/rear-cron directory. Prerequisites You have an NFS or SFTP server installed and configured on the backup node. For more information about creating a new NFS server, see Section 1.4, "Installing and configuring an NFS server on the backup node" . You have installed ReaR on the undercloud and control plane nodes. For more information, see Section 2.4, "Installing ReaR on the control plane nodes" . You have sufficient available disk space at your backup location to store the backup. Procedure To schedule a backup of your control plane nodes, run the following command. The default schedule is Sundays at midnight: openstack overcloud backup --cron 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 overcloud 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 overcloud 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 overcloud backup --cron --extra-vars '{"tripleo_backup_and_restore_cron_user": "root"}

Commands:
[stack@undercloud-0 ~]USD source stackrc (undercloud) [stack@undercloud ~]USD
(undercloud) [stack@undercloud ~]USD cat <<'EOF'> ~/nfs-inventory.yaml [BackupNode] <backup_node> ansible_host=<ip_address> ansible_user=<user> EOF
(undercloud) [stack@undercloud ~]USD ssh-copy-id -i ~/.ssh/id_rsa.pub <backup_node>
(undercloud) [stack@undercloud ~]USD openstack undercloud backup --setup-nfs --extra-vars /home/stack/bar-vars.yaml --inventory /home/stack/nfs-inventory.yaml
tripleo_controller_group_name: <group_names_list>
[stack@undercloud-0 ~]USD source stackrc
(undercloud) [stack@undercloud ~]USD cp ~/overcloud-deploy/<stack>/tripleo-ansible-inventory.yaml ~/tripleo-inventory.yaml
tripleo_backup_and_restore_server: <ip_address>
tripleo_backup_and_restore_output_url: sftp://<user>:<password>@<backup_node>/ tripleo_backup_and_restore_backup_url: iso:///backup/
(undercloud) [stack@undercloud ~]USD openstack overcloud backup --setup-rear --extra-vars /home/stack/bar-vars.yaml --inventory /home/stack/tripleo-inventory.yaml
sudo dnf install dosfstools efibootmgr
NETWORKING_PREPARATION_COMMANDS=('<command_1>' '<command_2>' ...')
[stack@undercloud-0 ~]USD lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 55G 0 disk ├─vda1 253:1 0 1M 0 part 1 ├─vda2 253:2 0 100M 0 part /boot/efi └─vda3 253:3 0 54.9G 0 part /
dd if=<config_drive_partition> of=/mnt/config-drive
[stack@undercloud-0 ~]USD source stackrc
(undercloud) [stack@undercloud ~]USD tripleo-ansible-inventory --ansible_ssh_user tripleo-admin --static-yaml-inventory /home/stack/tripleo-inventory.yaml
(undercloud) [stack@undercloud ~]USD openstack overcloud backup --inventory /home/stack/tripleo-inventory.yaml
openstack overcloud backup --cron
openstack overcloud backup --cron --extra-vars '{"tripleo_backup_and_restore_cron": "0 0 * * 0"}'
openstack overcloud backup --cron --extra-vars '{"tripleo_backup_and_restore_cron_extra":"--extra-vars bar-vars.yaml --inventory /home/stack/tripleo-inventory.yaml"}'
openstack overcloud backup --cron --extra-vars '{"tripleo_backup_and_restore_cron_user": "root"}