TOPICS
LANGUAGE

Backups

Note: This section applies only to FaunaDB Enterprise.

Backups in FaunaDB Enterprise consist of immutable snapshots of the current state of a node’s data. These snapshots are created individually on each node.

Each snapshot consists of hard links to data files. In this way, the storage overhead for an individual snapshot is low, as it does not require a separate copy of live data to be stored.

This page will cover all the basic backup operations:

  1. Creating a snapshot.
  2. Locating a snapshot.
  3. Listing snapshots; and
  4. Restoring a snapshot

Create a Snapshot

To create a snapshot:

$ faunadb-admin create-snapshot »SNAPSHOT-NAME«
Snapshot SNAPSHOT-NAME created. 

Where SNAPSHOT-NAME is some logical name for the snapshot, such as a YYYYMMDD datestamp.

A FaunaDB node will only snapshot the data on its local disk. Snapshotting all nodes in a single datacenter should be sufficient, as all datacenters will contain an entire copy of the dataset.

By default, the faunadb-admin tool communicates with the local FaunaDB instance running on the same node. In order to create a snapshot of all the data in a cluster, the faunadb-admin create-snapshot command must be run on each node in the cluster.

When taking a backup of an entire cluster’s data, it is helpful to create snapshots of different nodes at as close to the same time as possible. This will help maintain data consistency between the snapshots, and significantly reduce the time it takes to restore by limiting the transactions that are required to be resolved between the snapshots.

Locate a Snapshot

Snapshots are stored in the directory specified by the configuration key storage_snapshot_path. Each snapshot is in an individual subdirectory underneath this path, named with the snapshot name provided when it was created.

For example, if two snapshots were created with the names 20151201-1001 and 20151202-1001, and the storage_snapshot_path is /var/lib/faunadb/, those snapshots would be located in /var/lib/faunadb/20151201-1001 and /var/lib/faunadb/20151202-1001, respectively.

List Snapshots

To list all snapshots that currently exist in a node’s snapshot path:

$ faunadb-admin show-snapshots
20151201-1001 20151202-1001

Restore a Snapshot

To restore a snapshot:

$ faunadb-admin load-snapshot »absolute PATH«

Make sure to provide the absolute path to a snapshot as the PATH argument.

Restoring a snapshot will stream the appropriate data to all of the nodes in a cluster. An individual snapshot only needs to be restored on a single node.

To fully restore a backup from a multi-node cluster, a snapshot from all nodes of a single datacenter must be restored. Once a single datacenter is restored it can replicate the data to other datacenters in the cluster.

The status of snapshot restoration can be viewed in the FaunaDB logfile of the node that faunadb-admin is communicating with.

Log lines such as:

2018-03-19 14:26:49,513 Restore of HistoricalIndex from [Host ID] complete.

indicate the start of a snapshot restoration.