Bacula Enterprise Edition Documentation text image transdoc
Search

Main


Using Bacula Continous Data Protection

Continous Data Protection (CDP) also called continuous backup or real-time backup, refers to backup of Client data by automatically saving a copy of every change made to that data, essentially capturing every version of the data that the user saves. It allows the user or administrator to restore data to any point in time.

CDP Example

The Bacula Enterprise CDP feature is composed of two components. A application (cdp-client or tray-monitor) that will monitor a set of directories configured by the user and a Bacula FileDaemon plugin responsible to secure the data on a Bacula infrastructure.

The user application (cdp-client or tray-monitor) is responsible to monitor files and directories. When a modification is detected, a copy of the new data is done into a spool directory. At a regular interval, a Bacula backup job will contact the FileDaemon and will save all the files archived by the cdp-client. The local data can be restored at any time without a network connection to the Director.

Configuration

FileDaemon Configuration

As with all Bacula plugins, the Plugin Directory directive in the FileDaemon resource of the bacula-fd.conf file needs to be set:

FileDaemon {
  Name = test-fd
  ...
  Plugin Directory = /opt/bacula/plugins
}

Plugin Parameters

In order to configure the CDP Plugin, one of the following parameters must be set:

The following parameters are used in the CDP job.

  • user=<string> specifies a user in the system. The CDP Plugin will guess the location of the journal file for this user. Not available on Windows.
  • group=<string> specifies a group in the system. The CDP Plugin will guess the location of the journal files of the users from this group. Not available on Windows.
  • userHome=<string> specifies the path to the cdp User Home. This is where the CDP Plugin will look for the journal file. On Windows, this is the User AppData/Roaming folder, for example: "C:/Users/Auser/AppData/Roaming".

Director Configuration

FileSet {
  Name = cdp
  Include {
    Options {
      compression = LZO
    }

    Plugin = "cdp: userHome=/home/user1"
  }
}

Job {
  Name = CDP
  Client = myclient-fd
  Type = Backup
  Pool = Default
  Schedule = Hourly      # Choose a schedule
  Messages = Standard
  FileSet = cdp
}

CDP Client Configuration

-f <dir>
watches the directory <dir> for changes
-j <dir>
sets journal directory to <dir>. Default value is <HOME>
-s <dir>
sets spool directory to <dir>. Default value is <HOME>/.cdp-sdir
-d <nn>
set debug level to <nn>
-h
print help

Tray Monitor Configuration

You can setup the folders you wish to watch for changes by using the Tray Monitor.

Open the Tray Monitor options and click in the option Watch...:

Open CDP Client

You should see a window displaying the watched folders. Click in the button Add:

Select the folder you wish to watch:

You should see the watched folder listed, as in the image below:

The Spool Directory and Scheduled Backups

The Spool Directory contains all files from the watched folders that were created and / or changed. It keeps a copy of every version of the files.

An example of this directory can be seen below:

You must schedule backup jobs with a proper Files in order to backup those files with Bacula. Following this example, the job configuration would be:

FileSet {
  Name = cdp
  Include {
    Options {
      compression = LZO
    }
    Plugin = "cdp: userHome=/home/user1"
  }
}

Job {
  Name = CDP
  Client = myclient-fd
  Type = Backup
  Pool = Default
  Schedule = Hourly      # Choose a schedule
  Messages = Standard
  FileSet = cdp
}

The Job reads the journal file to select which files from the Spool Directory should be backed up. After that, the files will be available to be restored at any time:

Important

It's necessary to keep either the cdp-client or the tray-monitor running in order to protect the directories being watched.

Limitations

  • There is a limit in the number of folders that can be watched by default, which varies depending on your Operating System. You can increase that number by checking the correct procedure for your Operating System.
  • On Linux OSes, the CDP client implementation relies on the inotify API, therefore being subject to it's limitations (for example, it doesn't work with NFS). On Windows, the client relies on the ReadDirectoryChangesW API.