Skip to main content

Administrating MarkLogic Server

Backup Directory Structure

When you back up a database, you specify a backup directory. That directory must exist on each host in your configuration, and it must be readable and writable by the user running MarkLogic Server (by default, daemon on UNIX and the local System user on Windows). When you back up multiple databases, a good practice is to create one backup directory for each and name them accordingly. Because of the importance of database backup integrity, MarkLogic recommends backing up to a reliable filesystem. The backup directory structure for each host is the same, except that the forests are only backed up on the host from which they are served.

Below the specified backup directory, a subdirectory is created with a name based on the date when the backup begins. Each of these subdirectories contains one backup. Here is the basic backup directory structure:

<specified_backup_dir>/
   <date_1>-1/
      *.xml
      BackupTag.txt
      Forests/
         <security_forest_1>/
            <forest_files_and_directories>
         <security_forest_n>/
            <forest_files_and_directories>
         <schemas_forest_1>/
            <forest_files_and_directories>
         <schemas_forest_n>/
            <forest_files_and_directories>
         <database_forest_1>/
            <forest_files_and_directories>
         <database_forest_n>/
            <forest_files_and_directories>
         <triggers_forest_1>/
            <forest_files_and_directories>
         <triggers_forest_n>/
            <forest_files_and_directories>
   <date_1>-n/
       <backup_directory structure>
   <date_n>-1/
       <backup_directory structure>
   <date_n>-n/
       <backup_directory structure>

For example, if you back up a database to the /space/backups/Documents directory on September 1, 2004, a directory structure similar to this one is created:

/space/backups/Documents
   20040901-1/
      *.xml
      BackupTag.txt
      Forests/
         Documents/
            Label
            000001e1/
            Journals/
         Schemas/
            Label
            000001e1/
            Journals/
         Security/
            Label
            000001e1/
            Journals/
         Triggers/
            Label
            000001e1/
            Journals/
/space/backups/Modules
    ...

Incremental backups are stored in the directory under the full backup. In this example, the backup directory (backup-dir) is /space/backups/Documents, and the incremental backup directory (incremental-dir) is not used:

/space/backups/Documents
        20140801-1223942093224   (full backup on 8/1)
           20140802
               331006226070   (incremental backup on 8/2)
           20130803
               1341007528950   (incremental backup on 8/3)

The first part, 20140801, is the year, month, and day of the backup. The second part, 1223942093224, is the hour, minute, second, and nanosecond of the backup.

In this example, the backup directory (backup-dir) is /space/backups/Documents, and the incremental backup directory (incremental-dir) is /space/incremental:

/space/backups/Documents
        20140801-1223942093224   (full backup on 8/1)
/space/incremental
        20140801-1223942093224
           20140802
               331006226070   (incremental backup on 8/2)
           20140803
               341007528950    (incremental backup on 8/3)

The directory 20130801-1223942093224 is created on /space/incremental so that when the backup 20130801-1223942093224 is purged, its incremental backups can be purged easily.

If an incremental backup directory is specified, after the first incremental backup is done, the full backup can be archived to another location. The subsequent incremental backups do not need to examine the full backup.

Note

After you restore an incremental backup, you can no longer use the previous full backup location for ongoing incremental backups. After the restore, you need to make a fresh full backup and use the full backup location for ongoing incremental backups. This means that after the restore of an incremental backup, scheduled backups need to be updated to use the fresh full backup location.