Now that we have created an instance snapshot, imagine that we need to go back and recover files, or revert the application to the state it was at the time the snapshot was taken. As the snapshot is stored as an OpenStack image, you can boot directly from the snapshot, and as such all the details required to boot an instance applies to booting a snapshot.
To start an instance from a snapshot, you will need the following:
openstack
command-line clientopenrc
file containing appropriate credentialsThe instance we will boot will have the following attributes:
cookbook.test_snapshot-2017-09-08T163619
cookbook.test_restore
openstack.cookbook
public
(UUID)cookbook_key
ssh
To boot from an instance snapshot, we use the same process as used when booting an instance. The commands are repeated here:
openstack server list -c Name -c Status
This will bring back a list of ACTIVE
running instances:
openstack server create --flavor openstack.cookbook --image cookbook.test_snapshot-2017-09-08T163619 --nic net-id=6cb5a4ce-1ea5-4817-9c34-a2212a66f394 --security-group bd7d5e0f-538a-4d93-b123-98cc3207b3d2 --key-name cookbook_key cookbook.test_restore
This will bring back the familiar booting an instance output that has been omitted here.
cookbook.test_restore
instance is ACTIVE
:openstack server list -c Name -c Status
This shows our instance is now running:
As instance snapshots are stored as OpenStack images, booting from a snapshot is an identical process to booting from an existing image. There are some caveats however. As snapshots are created while an image is running, booting from them is similar to booting a server after a power failure. You must also ensure that you are using a flavor that is of equal or greater size to the original instance—for example, if an instance was originally created as an m1.large, the snapshot must be booted with an m1.large or greater flavor. Additionally, if the instance is a Windows image attached to an Active Directory domain, it may cause issues having two of the same instances running at the same time. To mitigate this, consider booting the instance onto a separate recovery network.
There are tools available to quiesce the filesystem inside an instance and provide a more consistent image that are beyond the scope of this book. However, as guidance, ensuring that a filesystem sync (to flush any disk writes) inside the running instance is recommended before a snapshot is taken.
3.128.30.193