1
Title: Backup and Recovery - OpenStack
4
# Backup and Recovery - OpenStack
8
The OpenStack flexibility makes backup and restore to a very individual process
9
depending on the used components. This section describes how the critical parts
10
like the configuration files and databases OpenStack needs to run are saved. As
11
before for Juju it doesn't describe ho to back up the objects inside the Object
12
Storage or the data inside the Block Storage.
18
## Backup Cloud Controller Database
20
Like Juju the OpenStack cloud controller uses a database server which stores the
21
central databases for Nova, Glance, Keystone, Cinder, and Switft. You can backup
22
the five databases into one common dump:
25
$ mysqldump --opt --all-databases > openstack.sql
28
Alternatively you can backup the database for each component individually:
31
$ mysqldump --opt nova > nova.sql
32
$ mysqldump --opt glance > glance.sql
33
$ mysqldump --opt keystone > keystone.sql
34
$ mysqldump --opt cinder > cinder.sql
35
$ mysqldump --opt swift > swift.sql
38
## Backup File Systems
40
Beside the databases OpenStack uses different directories for its configuration,
41
runtime files, and logging. Like the databases they are grouped individually per
42
component. This way also the backup can be done per component.
46
You'll find the configuration directory `/etc/nova` on the cloud controller and
47
each compute node. It should be regularly backed up.
49
Another directory to backup is `/var/lib/nova`. But here you have to be careful
50
with the `instances` subdirectory on the compute nodes. It contains the KVM images
51
of the running instances. If you want to maintain backup copies of those instances
52
you can do a backup here too. In this case make sure to not save a live KVM instance
53
because it may not boot properly after restoring the backup.
55
Third directory for the compute component is `/var/log/nova`. In case of a central
56
logging server this directory does not need to be backed up. So we suggest you to
57
run your environment with this kind of logging.
61
Like for Nova you'll find the directories `/etc/glance` and `/var/log/glance`, the
62
handling should be the same here too.
64
Glance also uses the directory named `/var/lib/glance` which also should be backed
69
Keystone is using the directories `/etc/keystone`, `/var/lib/keystone`, and
70
`/var/log/keystone`. They follow the same rules as Nova and Glance. Even if
71
the `lib` directory should not contain any data being used, can also be backed
76
Like before you'll find the directories `/etc/cinder`, `/var/log/cinder`,
77
and `/var/lib/cinder`. And also here the handling should be the same. Opposite
78
to Nova abd Glance there's no special handling of `/var/lib/cinder` needed.
82
Beside the Swift configuration the directory `/etc/swift` contains the ring files
83
and the ring builder files. If those get lest the data on your data gets inaccessable.
84
So you can easily imagine how important it is to backup this directory. Best practise
85
is to copy the builder files to the storage nodes along with the ring files. So
86
multiple copies are spread throughout the cluster.
88
**TODO(mue)** Really needed when we use Ceph for storage?
92
The restore based on the backups is a step-by-step process restoring the components
93
databases and all their directories. It's important that the component to restore is
94
currently not running. So always start the restoring with stopping all components.
96
Let's take Nova as an example. First execute
101
$ stop nova-consoleauth
102
$ stop nova-novncproxy
103
$ stop nova-objectstore
104
$ stop nova-scheduler
107
on the cloud controller to savely stop the processes of the component. Next step is the
108
restore of the database. By using the `--opt` option during backup we ensured that all
109
tables are initially dropped and there's no conflict with currently existing data in
113
$ mysql nova < nova.sql
116
Before restoring the directories you should move at least the configuration directoy,
117
here `/etc/nova`, into a secure location in case you need to roll it back.
119
After the database and the files are restored you can start MySQL and Nova again.
125
$ start nova-consoleauth
126
$ start nova-novncproxy
127
$ start nova-objectstore
128
$ start nova-scheduler
131
The process for the other components look similar.