13.2. Scheduling Automated Snapshots

Documentation

VoltDB Home » Documentation » Using VoltDB

13.2. Scheduling Automated Snapshots

Save and restore are useful when planning for scheduled down times. However, these functions are also important for reducing the risk from unexpected outages. VoltDB assists in contingency planning and recovery from such worst case scenarios as power failures, fatal system errors, or data corruption due to application logic errors.

In these cases, the database stops unexpectedly or becomes unreliable. By automatically generating snapshots at set intervals, VoltDB gives you the ability to restore the database to a previous valid state.

You schedule automated snapshots of the database as part of the configuration file. The <snapshot> tag lets you specify:

  • The frequency of the snapshots. You can specify any whole number of seconds, minutes, or hours (using the suffix "s", "m", or "h", respectively, to denote the unit of measure). For example "3600s", "60m", and "1h" are all equivalent. The default frequency is 24 hours.

  • The unique identifier to use as a prefix for the snapshot files. The default prefix is "AUTOSNAP".

  • The number of snapshots to retain. Snapshots are marked with a timestamp (as part of the file names), so multiple snapshots can be saved. The retain attribute lets you specify how many snapshots to keep. Older snapshots are purged once this limit is reached. The default number of snapshots retained is two.

The following example enables automated snapshots every thirty minutes using the prefix "flightsave" and keeping only the three most recent snapshots.

<snapshot prefix="flightsave" 
          frequency="30m" 
          retain="3"
/>

By default, automated snapshots are stored in a snapshots subfolder of the VoltDB root directory (as described in Section 3.7.2, “Configuring Paths for Runtime Features”). You can save the snapshots to a specific path by adding the <snapshots> tag within to the <paths>...</paths> tag set. For example, the following example defines the path for automated snapshots as /etc/voltdb/autobackup/.

<paths>
   <snapshots path="/etc/voltdb/autobackup/" />
</paths>