8.3. Preventative Maintenance Using Snapshots


VoltDB Home » Documentation » Enterprise Manager Guide

8.3. Preventative Maintenance Using Snapshots

K-safety is one way to ensure the durability of the database by protecting the cluster against individual node failures. Another important feature for ensuring the viability of the cluster is the use of snapshots to save and restore the data from disk.

If you have automatic snapshotting turned on, the Enterprise Manager helps you manage your snapshots by optionally collecting the created snapshots and copying them to the management server. These features are available from the Edit button on the Snapshot Settings panel of the dashboard.

The following sections explain how to use the Enterprise Manager to restore a database and manage your database snapshots.

8.3.1. Collecting Snapshots

When you create the database, you get to choose whether to create automated snapshots, and whether those snapshots are copied to the management server. Once the database exists, you can revisit these settings by clicking on the Edit button in the Snapshot Settings panel of the dashboard.

The Edit Snapshots dialog box lets you change the settings for automated snapshots. You can modify the frequency of automated snapshots, how many snapshots are retained, and whether automated snapshots are copied to the management server. Once you make the desired changes, click OK to have the changes take effect or click Cancel to discard the changes and close the dialog box.

The Edit Snapshots dialog also lets you take a manual snapshot. Whether automated snapshots are enabled or not or whether copy to management server is enabled or not, a manual snapshot is always copied to the management server and made available to you. When you click on the Take a Snapshot button, the manual snapshot is initiated. After the snapshot is complete, the Enterprise Manager will copy the snapshot to the management server and display it in the list of available snapshots.

8.3.2. Restoring the Database from a Snapshot

Collecting the snapshot files provides assurance against failure. If the database fails for any reason, you can use the snapshots to restore the database's contents to a known state. You can also use the snapshots to save and restore the database in cases where you know you must take the cluster down for maintenance.

If you know that the database cluster must shutdown, you can use the following procedure to capture a known state of the database.

  1. Pause the database, putting it in admin mode and stopping further client activity, by clicking on the database name in the global list of databases and selecting Pause from the popup menu.

  2. If automated snapshots are not currently being copied to the management server, click on Edit in the Snapshot Settings panel to bring up the Edit Snapshots dialog box. Check the box for copying snapshots, then click OK. Or, if automated snapshots are disabled, use the Edit Snapshot Settings dialog to take a manual snapshot.

  3. Wait for the snapshot to complete and be copied to the management server. At this point all client activity should have stopped and you can be assured that this last snapshot is complete.

  4. Shutdown the database by clicking the Stop Database button.

At this point the cluster can be shutdown, repaired, replaced, or other maintenance completed. Once the servers are ready to start again, use the following procedure to restore the last valid snapshot of the database.

  1. In the Enterprise Manager dashboard, click on the Start Database button.

  2. In the Start Database dialog box that appears, select the option for "Start and restore from a snapshot".

  3. Next, select the snapshot you want to restore. (The snapshots are listed with the most recent first.)

  4. Click Start.

When you follow these steps, the Enterprise Manager will start the database and restore the selected snapshot to return the database contents to their previous state. Note that the snapshots must be copied to the management server before they become available for use in restoring the database on start.

8.3.3. Managing Snapshots

Over time, the number of snapshots that the Enterprise Manager collects can grow. You should periodically clean up the list be removing old and outdated snapshots.

  • For snapshots you no longer need, you can prune the list by selecting one or more snapshots from the list and clicking the Delete button. The selected snapshots are deleted from the management server and removed from the list.

  • For snapshots you want to save but not necessarily reuse in the Enterprise Manager, you can select those snapshots and click on Download. The selected snapshots are zipped into a single compressed file each and downloaded to your current system. (That is, the computer whose web browser you are using to access the management server.)

While cleaning up, be sure to keep any snapshots you may want to use later to restore the database. The Enterprise Manager can only restore snapshots that are on the management server.