see on GitHub

Backup Overview



Backing-Up and Restoring a Database

Backup Scope: Full or Incremental

  • You can set the Backup task to create either full or incremental backups during its periodical executions.

    • A full-backup file contains all current database contents and configuration.
      • Creating a full-backup file normally takes longer and requires more storage space than creating an incremental-backup file.
    • An incremental-backup file contains only the difference between present data and data already backed up.
      • An incremental-backup file is normally faster to create and smaller to keep than a full-backup file.
      • An incremental-backup file always updates a previous backup-file.
        If you set the Backup task to create incremental backups but a previous backup file doesn't exist -
        Backup will create a full backup first.
        Subsequent backups will be incremental.
  • A typical configuration would be quick incremental-backup runs that "fill the gaps" between full backups.
    For example -

    • A full-backup task set to run every 12 hours,
    • and an incremental-backup task that runs every 30 minutes.

A Typical Backup Folder

A typical backup folder holds a single full-backup file, and a list of incremental-backup files.

  • Each incremental backup updates its predecessors, and the whole structure illustrates the backup's chronology.
  • Folder contents sample:
    • 2018-12-26-09-00.ravendb-full-backup
    • 2018-12-26-12-00.ravendb-incremental-backup
    • 2018-12-26-15-00.ravendb-incremental-backup
    • 2018-12-26-18-00.ravendb-incremental-backup

Restoration Procedure

In order to restore a database, RavenDB -

  • Browses the backup folder.
    On your part, you need only to provide the backup-folder's path.
  • Restores the full backup it finds in this folder.
    A backup folder typically contains a single full backup, and the incremental backups that supplement it.
  • Restores incremental backups one by one.
    By default, RavenDB will restore all incremental backup files to the last.
    You can also use LastFileNameToRestore to stop restoration when a certain file is reached.

Overview

Backup Type: Logical-Backup or Snapshot

There are two backup types: Logical-backup (or simply "Backup") and Snapshot.

  • A logical-backup is a compressed JSON dump of database contents, including documents and other data.
  • A SnapShot is a binary image of the database and journals at a given point-in-time.
    • Using Snapshots is available only for Enterprise subscribers.

Encryption

Stored data can be Encrypted or Unencrypted.


Compression

  • A backup always consists of a single compressed file.
    It is so for all backup formats: full "logical" backup dumps, snapshot images, and the incremental backups that supplement both.
  • Data is compressed using gzip.

Backup Name

Backup folders and files are named automatically. Their names are constructed of:

  • Current Date and Time
  • Backed-up Database Name
  • Owner-Node Tag
  • Backup Type ("backup" or "snapshot")
  • Backup Scope ("full-backup" or "incremental-backup")

For example:

  • 2018-12-26-16-17.ravendb-Products-A-backup is the name automatically given to a backup folder.
    • "2018-12-26-16-17" - Backup Date and time
    • "Products" - Backed-up Database name
    • "A" - Executing node's tag
    • "backup" - Backup type (backup/snapshot)
  • 2018-12-26-16-17.ravendb-full-backup is the name automatically given to the backup file inside this folder.
    • "full-backup" - For a full backup; an incremental backup's name will state "incremental-backup".

Backup Contents

Backed-up data includes database-level and cluster-level contents.

  • Database-level contents is data contained in the database and related to its state, and additional data types and entities.
  • Cluster-level data includes additional data, related to the behavior of the cluster.
Database-level data Cluster-level data
Documents Database Record (Revisions, Expiration, Client configuration and Connection strings )
Attachments Compare-exchange values
Revisions Identities
Counters Indexes
(Logical-Backups: Only Index definitions)
Tombstones Tasks state (Snapshot only)
Conflicts