OpsGuide-Backup-Recovery

= Backup and Recovery =

Standard backup best practices apply when creating your OpenStack backup policy. For example, how often to back up your data is closely related to how quickly you need to recover from data loss.

note

If you cannot have any data loss at all, you should also focus on a highly available deployment. The OpenStack High Availability Guide offers suggestions for elimination of a single point of failure that could cause system downtime. While it is not a completely prescriptive document, it offers methods and techniques for avoiding downtime and data loss. Other backup considerations include:


 * How many backups to keep?
 * Should backups be kept off-site?
 * How often should backups be tested?

Just as important as a backup policy is a recovery policy (or at least recovery testing).

What to Back Up
While OpenStack is composed of many components and moving parts, backing up the critical data is quite simple.

This chapter describes only how to back up configuration files and databases that the various OpenStack components need to run. This chapter does not describe how to back up objects inside Object Storage or data contained inside Block Storage. Generally these areas are left for users to back up on their own.

Database Backups
The example OpenStack architecture designates the cloud controller as the MySQL server. This MySQL server hosts the databases for nova, glance, cinder, and keystone. With all of these databases in one place, it's very easy to create a database backup:

# mysqldump --opt --all-databases &gt; openstack.sql If you only want to backup a single database, you can instead run:

# mysqldump --opt nova &gt; nova.sql where  is the database you want to back up.

You can easily automate this process by creating a cron job that runs the following script once per day:

This script dumps the entire MySQL database and deletes any backups older than seven days.

File System Backups
This section discusses which files and directories should be backed up regularly, organized by service.

Compute
The  directory on both the cloud controller and compute nodes should be regularly backed up.

does not need to be backed up if you have all logs going to a central area. It is highly recommended to use a central logging server or back up the log directory.

is another important directory to back up. The exception to this is the  subdirectory on compute nodes. This subdirectory contains the KVM images of running instances. You would want to back up this directory only if you need to maintain backup copies of all instances. Under most circumstances, you do not need to do this, but this can vary from cloud to cloud and your service levels. Also be aware that making a backup of a live KVM instance can cause that instance to not boot properly if it is ever restored from a backup.

Image Catalog and Delivery
and  follow the same rules as their nova counterparts.

should also be backed up. Take special notice of. If you are using a file-based back end of glance,  is where the images are stored and care should be taken.

There are two ways to ensure stability with this directory. The first is to make sure this directory is run on a RAID array. If a disk fails, the directory is available. The second way is to use a tool such as rsync to replicate the images to another server:

# rsync -az --progress /var/lib/glance/images backup-server:/var/lib/glance/images/

Identity
and  follow the same rules as other components.

, although it should not contain any data being used, can also be backed up just in case.

Block Storage
and  follow the same rules as other components.

should also be backed up.

Networking
and  follow the same rules as other components.

should also be backed up.

Object Storage
is very important to have backed up. This directory contains the swift configuration files as well as the ring files and ring builder files &lt;builder file&gt;, which if lost, render the data on your cluster inaccessible. A best practice is to copy the builder files to all storage nodes along with the ring files. Multiple backup copies are spread throughout your storage cluster.

Telemetry
Back up the  directory containing Telemetry configuration files.

Orchestration
Back up HOT template  files, and the   directory containing Orchestration configuration files.

Recovering Backups
Recovering backups is a fairly simple process. To begin, first ensure that the service you are recovering is not running. For example, to do a full recovery of  on the cloud controller, first stop all   services:

# stop nova-api Now you can import a previously backed-up database:
 * 1) stop nova-consoleauth
 * 2) stop nova-novncproxy
 * 3) stop nova-objectstore
 * 4) stop nova-scheduler

# mysql nova &lt; nova.sql You can also restore backed-up nova directories:

# mv /etc/nova{,.orig} Once the files are restored, start everything back up:
 * 1) cp -a /path/to/backup/nova /etc/

# start mysql nova-objectstore nova-scheduler &gt; do &gt; start $i &gt; done Other services follow the same process, with their respective directories and databases.
 * 1) for i in nova-api nova-consoleauth nova-novncproxy \

Summary
Backup and subsequent recovery is one of the first tasks system administrators learn. However, each system has different items that need attention. By taking care of your database, image service, and appropriate file system locations, you can be assured that you can handle any event requiring recovery.