이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Back Up and Restore the Director Undercloud
Back up and restore the director undercloud
Abstract
Chapter 1. Back Up the Undercloud 링크 복사링크가 클립보드에 복사되었습니다!
This guide describes how to back up the undercloud used in the Red Hat OpenStack Platform director. The undercloud is usually a single physical node (although high availability options exist using a two-node pacemaker cluster that runs director in a VM) that is used to deploy and manage your OpenStack environment.
1.1. Backup Considerations 링크 복사링크가 클립보드에 복사되었습니다!
Formulate a robust back up and recovery policy in order to minimize data loss and system downtime. When determining your back up strategy, you will need to answer the following questions:
- How quickly will you need to recover from data loss? If you cannot have data loss at all, you should include high availability in your deployment strategy, in addition to using backups. You’ll need to consider how long it will take to obtain the physical backup media (including from an offsite location, if used), and how many tape drives are available for restore operations.
- How many backups should you keep? You will need to consider legal and regulatory requirements that affect how long you are expected to store data.
- Should your backups be kept off-site? Storing your backup media offsite will help mitigate the risk of catastrophe befalling your physical location.
- How often should backups be tested? A robust back up strategy will include regular restoration tests of backed up data. This can help validate that the correct data is still being backed up, and that no corruption is being introduced during the back up or restoration processes. These drills should assume that they are being performed under actual disaster recovery conditions.
- What will be backed up? The following sections describe database and file-system backups for components, as well as information on recovering backups.
1.2. High Availability of the Undercloud node 링크 복사링크가 클립보드에 복사되었습니다!
You are free to consider your preferred high availability (HA) options for the Undercloud node; Red Hat does not prescribe any particular requirements for this. For example, you might consider running your Undercloud node as a highly available virtual machine within Red Hat Enterprise Virtualization (RHEV). You might also consider using physical nodes with Pacemaker providing HA for the required services.
When approaching high availability for your Undercloud node, you should consult the documentation and good practices of the solution you decide works best for your environment.
1.3. Creating a baremetal Undercloud backup 링크 복사링크가 클립보드에 복사되었습니다!
A full undercloud backup includes the following databases and files:
- All MariaDB databases on the undercloud node
- MariaDB configuration file on the undercloud (so that you can accurately restore databases)
-
The configuration data:
/etc -
Log data:
/var/log -
Image data:
/var/lib/glance -
Certificate generation data if using SSL:
/var/lib/certmonger -
All swift data:
/srv/node -
All data in the stack user home directory:
/home/stack
Confirm that you have sufficient disk space available on the undercloud before performing the backup process. Expect the archive file to be at least 3.5 GB, if not larger.
Procedure
-
Log into the undercloud as the
rootuser. Create a
backupdirectory, and change the user ownership of the directory to thestackuser:mkdir /backup chown stack: /backup
[root@director ~]# mkdir /backup [root@director ~]# chown stack: /backupCopy to Clipboard Copied! Toggle word wrap Toggle overflow From the
backupdirectory, back up the database:cd /backup mysqldump --opt --all-databases > /root/undercloud-all-databases.sql
[root@director ~]# cd /backup [root@director backup]# mysqldump --opt --all-databases > /root/undercloud-all-databases.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Archive the database backup and the configuration files:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The
--ignore-failed-readoption skips any directory that does not apply to your undercloud. -
The
--xattrsoption includes extended attributed, which are required to store metadata for Object Storage (swift).
This creates a file named
undercloud-backup-<date>.tar.gz, where<date>is the system date. Copy thistarfile to a secure location.-
The
1.4. Validate the Completed Backup 링크 복사링크가 클립보드에 복사되었습니다!
You can validate the success of the completed back up process by running and validating the restore process. See the next section for further details on restoring from backup.
Part I. Restore the Undercloud 링크 복사링크가 클립보드에 복사되었습니다!
This section describes how to restore the undercloud used in the Red Hat OpenStack Platform Director.
Chapter 2. Restoring the undercloud 링크 복사링크가 클립보드에 복사되었습니다!
The following restore procedure assumes your undercloud node has failed and is in an unrecoverable state. This procedure involves restoring the database and critical filesystems on a fresh installation. It assumes the following:
- You have re-installed the latest version of Red Hat Enterprise Linux 7.
- The hardware layout is the same.
- The hostname and undercloud settings of the machine are the same.
-
The backup archive has been copied to the
rootdirectory.
Procedure
-
Log into your undercloud as the
rootuser. Register your system with the Content Delivery Network, entering your Customer Portal user name and password when prompted:
subscription-manager register
[root@director ~]# subscription-manager registerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Attach the Red Hat OpenStack Platform entitlement:
subscription-manager attach --pool=Valid-Pool-Number-123456
[root@director ~]# subscription-manager attach --pool=Valid-Pool-Number-123456Copy to Clipboard Copied! Toggle word wrap Toggle overflow Disable all default repositories, and then enable the required Red Hat Enterprise Linux repositories:
subscription-manager repos --disable=* subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-rh-common-rpms --enable=rhel-ha-for-rhel-7-server-rpms --enable=rhel-7-server-openstack-10-rpms
[root@director ~]# subscription-manager repos --disable=* [root@director ~]# subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-rh-common-rpms --enable=rhel-ha-for-rhel-7-server-rpms --enable=rhel-7-server-openstack-10-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Perform an update on your system to make sure you have the latest base system packages:
yum update -y reboot
[root@director ~]# yum update -y [root@director ~]# rebootCopy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure the time on your undercloud is synchronized. For example:
yum install -y ntp systemctl start ntpd systemctl enable ntpd ntpdate pool.ntp.org systemctl restart ntpd
[root@director ~]# yum install -y ntp [root@director ~]# systemctl start ntpd [root@director ~]# systemctl enable ntpd [root@director ~]# ntpdate pool.ntp.org [root@director ~]# systemctl restart ntpdCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Copy the undercloud backup archive to the undercloud’s
rootdirectory. The following steps useundercloud-backup-$TIMESTAMP.taras the filename, where $TIMESTAMP is a Bash variable for the timestamp on the archive. Install the database server and client tools:
yum install -y mariadb mariadb-server
[root@director ~]# yum install -y mariadb mariadb-serverCopy to Clipboard Copied! Toggle word wrap Toggle overflow Start the database:
systemctl start mariadb systemctl enable mariadb
[root@director ~]# systemctl start mariadb [root@director ~]# systemctl enable mariadbCopy to Clipboard Copied! Toggle word wrap Toggle overflow Increase the allowed packets to accommodate the size of our database backup:
mysql -uroot -e"set global max_allowed_packet = 1073741824;"
[root@director ~]# mysql -uroot -e"set global max_allowed_packet = 1073741824;"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Extract the database and database configuration from the archive:
tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/my.cnf.d/*server*.cnf tar -xvC / -f undercloud-backup-$TIMESTAMP.tar root/undercloud-all-databases.sql
[root@director ~]# tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/my.cnf.d/*server*.cnf [root@director ~]# tar -xvC / -f undercloud-backup-$TIMESTAMP.tar root/undercloud-all-databases.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restore the database backup:
mysql -u root < /root/undercloud-all-databases.sql
[root@director ~]# mysql -u root < /root/undercloud-all-databases.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Extract a temporary version of the root configuration file:
tar -xvf undercloud-backup-$TIMESTAMP.tar root/.my.cnf
[root@director ~]# tar -xvf undercloud-backup-$TIMESTAMP.tar root/.my.cnfCopy to Clipboard Copied! Toggle word wrap Toggle overflow Get the old root database password:
OLDPASSWORD=$(sudo cat root/.my.cnf | grep -m1 password | cut -d'=' -f2 | tr -d "'")
[root@director ~]# OLDPASSWORD=$(sudo cat root/.my.cnf | grep -m1 password | cut -d'=' -f2 | tr -d "'")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reset the root database password:
mysqladmin -u root password "$OLDPASSWORD"
[root@director ~]# mysqladmin -u root password "$OLDPASSWORD"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the root configuration file from the temporary directory to the
rootdirectory:mv ~/root/.my.cnf ~/. rmdir ~/root
[root@director ~]# mv ~/root/.my.cnf ~/. [root@director ~]# rmdir ~/rootCopy to Clipboard Copied! Toggle word wrap Toggle overflow Get a list of old user permissions:
mysql -e 'select host, user, password from mysql.user;'
[root@director ~]# mysql -e 'select host, user, password from mysql.user;'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the old user permissions for each host listed. For example:
HOST="192.0.2.1" USERS=$(mysql -Nse "select user from mysql.user WHERE user != \"root\" and host = \"$HOST\";" | uniq | xargs) for USER in $USERS ; do mysql -e "drop user \"$USER\"@\"$HOST\"" || true ;done mysql -e 'flush privileges'
[root@director ~]# HOST="192.0.2.1" [root@director ~]# USERS=$(mysql -Nse "select user from mysql.user WHERE user != \"root\" and host = \"$HOST\";" | uniq | xargs) [root@director ~]# for USER in $USERS ; do mysql -e "drop user \"$USER\"@\"$HOST\"" || true ;done [root@director ~]# mysql -e 'flush privileges'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Perform this for all users accessing through the host IP and any host ("
%")Restart the database:
systemctl restart mariadb
[root@director ~]# systemctl restart mariadbCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
stackuser:useradd stack
[root@director ~]# useradd stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set a password for the user:
passwd stack
[root@director ~]# passwd stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Disable password requirements when using
sudo:echo "stack ALL=(root) NOPASSWD:ALL" | tee -a /etc/sudoers.d/stack chmod 0440 /etc/sudoers.d/stack
[root@director ~]# echo "stack ALL=(root) NOPASSWD:ALL" | tee -a /etc/sudoers.d/stack [root@director ~]# chmod 0440 /etc/sudoers.d/stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restore the
stackuser home directory:tar -xvC / -f undercloud-backup-$TIMESTAMP.tar home/stack
# tar -xvC / -f undercloud-backup-$TIMESTAMP.tar home/stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
policycoreutils-pythonpackage:yum -y install policycoreutils-python
[root@director ~]# yum -y install policycoreutils-pythonCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
openstack-glancepackage and restore its data and file permissions:yum install -y openstack-glance tar --xattrs -xvC / -f undercloud-backup-$TIMESTAMP.tar var/lib/glance/images chown -R glance: /var/lib/glance/images restorecon -R /var/lib/glance/images
[root@director ~]# yum install -y openstack-glance [root@director ~]# tar --xattrs -xvC / -f undercloud-backup-$TIMESTAMP.tar var/lib/glance/images [root@director ~]# chown -R glance: /var/lib/glance/images [root@director ~]# restorecon -R /var/lib/glance/imagesCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
openstack-swiftpackage and restore its data and file permissions:yum install -y openstack-swift tar --xattrs -xvC / -f undercloud-backup-$TIMESTAMP.tar srv/node chown -R swift: /srv/node restorecon -R /srv/node
[root@director ~]# yum install -y openstack-swift [root@director ~]# tar --xattrs -xvC / -f undercloud-backup-$TIMESTAMP.tar srv/node [root@director ~]# chown -R swift: /srv/node [root@director ~]# restorecon -R /srv/nodeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
openstack-keystonepackage and restore its configuration data:yum -y install openstack-keystone tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/keystone restorecon -R /etc/keystone
[root@director ~]# yum -y install openstack-keystone [root@director ~]# tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/keystone [root@director ~]# restorecon -R /etc/keystoneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
openstack-heatand restore configuration:yum install -y openstack-heat* tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/heat restorecon -R /etc/heat
[root@director ~]# yum install -y openstack-heat* [root@director ~]# tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/heat [root@director ~]# restorecon -R /etc/heatCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install puppet and restore its configuration data:
yum install -y puppet hiera tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/puppet/hieradata/
[root@director ~]# yum install -y puppet hiera [root@director ~]# tar -xvC / -f undercloud-backup-$TIMESTAMP.tar etc/puppet/hieradata/Copy to Clipboard Copied! Toggle word wrap Toggle overflow If using SSL in the undercloud, refresh the CA certificates:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Switch to the
stackuser:su - stack
[root@director ~]# su - stack [stack@director ~]$Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
python-tripleoclientpackage:sudo yum install -y python-tripleoclient
$ sudo yum install -y python-tripleoclientCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the undercloud installation command. Ensure to run it in the
stackuser’s home directory:openstack undercloud install
[stack@director ~]$ openstack undercloud installCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Wait until the install completes. The undercloud automatically restores its connection to the overcloud. The nodes will continue to poll OpenStack Orchestration (heat) for pending tasks.
Chapter 3. Restoring images for overcloud nodes 링크 복사링크가 클립보드에 복사되었습니다!
The director requires the latest disk images for provisioning new overcloud nodes. Follow this procedure to restore these images.
Procedure
Source the
stackrcfile to enable the director’s command line tools:source ~/stackrc
[stack@director ~]$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
rhosp-director-imagesandrhosp-director-images-ipapackages:sudo yum install rhosp-director-images rhosp-director-images-ipa
(undercloud) [stack@director ~]$ sudo yum install rhosp-director-images rhosp-director-images-ipaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Extract the images archives to the
imagesdirectory in thestackuser’s home (/home/stack/images):cd ~/images for i in /usr/share/rhosp-director-images/overcloud-full-latest-10.0.tar /usr/share/rhosp-director-images/ironic-python-agent-latest-10.0.tar; do tar -xvf $i; done
(undercloud) [stack@director ~]$ cd ~/images (undercloud) [stack@director images]$ for i in /usr/share/rhosp-director-images/overcloud-full-latest-10.0.tar /usr/share/rhosp-director-images/ironic-python-agent-latest-10.0.tar; do tar -xvf $i; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Import these images into the director:
cd ~/images openstack overcloud image upload --image-path /home/stack/images/
(undercloud) [stack@director images]$ cd ~/images (undercloud) [stack@director images]$ openstack overcloud image upload --image-path /home/stack/images/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure nodes in your environment to use the new images:
for NODE in $(openstack baremetal node list -c UUID -f value) ; do openstack overcloud node configure $NODE ; done
(undercloud) [stack@director images]$ for NODE in $(openstack baremetal node list -c UUID -f value) ; do openstack overcloud node configure $NODE ; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 4. Validate the Completed Restore 링크 복사링크가 클립보드에 복사되었습니다!
Use the following commands to perform a healthcheck of your newly restored environment:
4.1. Check Identity Service (Keystone) Operation 링크 복사링크가 클립보드에 복사되었습니다!
This step validates Identity Service operations by querying for a list of users.
source stackrc openstack user list
# source stackrc
# openstack user list
When run from the controller, the output of this command should include a list of users created in your environment. This action demonstrates that keystone is running and successfully authenticating user requests. For example: