| 1 |
\chapter{Using \bacula{} CDP} |
| 2 |
\label{blb:cdp} |
| 3 |
\index[general]{CDP} |
| 4 |
\index[general]{Continuous Data Protection} |
| 5 |
|
| 6 |
\ac{CDP} also called continuous backup or real-time |
| 7 |
backup, refers to backup of Client data by automatically saving a copy of |
| 8 |
every change made to that data, essentially capturing every version of the data |
| 9 |
that the user saves. It allows the user or administrator to restore data to any |
| 10 |
point in time. |
| 11 |
|
| 12 |
\bimageH%[0.9\linewidth] |
| 13 |
{cdp}{\acs{CDP} Example}{fig:cdp} |
| 14 |
|
| 15 |
The \baculaenterprise{} \acs{CDP} feature is composed of two components. A |
| 16 |
application (\btool{cdp-client} or \btool{tray-monitor}) that will monitor a |
| 17 |
set of directories configured by the user and a \bacula{} FileDaemon plugin |
| 18 |
responsible to secure the data on a \bacula{} infrastructure. |
| 19 |
|
| 20 |
The user application (\btool{cdp-client} or \btool{tray-monitor}) is |
| 21 |
responsible to monitor files and directories. When a modification is detected, |
| 22 |
a copy of the new data is done into a \bdirectoryname{spool} directory. At a regular |
| 23 |
interval, a \bacula{} backup job will contact the FileDaemon and will save all |
| 24 |
the files archived by the \btool{cdp-client}. The local data can be restored |
| 25 |
at any time without a network connection to the Director. |
| 26 |
|
| 27 |
\section{Configuration} |
| 28 |
|
| 29 |
\subsection{FileDaemon Configuration} |
| 30 |
|
| 31 |
As with all \bacula{} plugins, the \bdirectivename{Plugin Directory} directive in the |
| 32 |
\bdirectivename{FileDaemon} resource of the \bfilename{bacula-fd.conf} file needs to be |
| 33 |
set: |
| 34 |
\begin{bVerbatim} |
| 35 |
FileDaemon { |
| 36 |
Name = test-fd |
| 37 |
... |
| 38 |
Plugin Directory = /opt/bacula/plugins |
| 39 |
} |
| 40 |
\end{bVerbatim} |
| 41 |
|
| 42 |
\subsection{Plugin Parameters} |
| 43 |
|
| 44 |
In order to configure the CDP Plugin, one of the following parameters must be set: |
| 45 |
|
| 46 |
The following parameters are used in the \acs{CDP} job. |
| 47 |
|
| 48 |
\begin{bitemize} |
| 49 |
\item \texttt{user=<string>} specifies a user in the system. The CDP Plugin will guess the location of the journal file for this user. \bhighlight{Not available on Windows.} |
| 50 |
\item \texttt{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. \bhighlight{Not available on Windows.} |
| 51 |
\item \texttt{userHome=<string>} specifies the path to the \texttt{cdp} User Home. This is where the CDP Plugin will look for the journal file. \bhighlight{On Windows, this is the User AppData/Roaming folder, for example: "C:/Users/Auser/AppData/Roaming".} |
| 52 |
\end{bitemize} |
| 53 |
|
| 54 |
\subsection{Director Configuration} |
| 55 |
|
| 56 |
\begin{bVerbatim} |
| 57 |
FileSet { |
| 58 |
Name = cdp |
| 59 |
Include { |
| 60 |
Options { |
| 61 |
compression = LZO |
| 62 |
} |
| 63 |
|
| 64 |
Plugin = "cdp: userHome=/home/user1" |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
Job { |
| 69 |
Name = CDP |
| 70 |
Client = myclient-fd |
| 71 |
Type = Backup |
| 72 |
Pool = Default |
| 73 |
Schedule = Hourly # Choose a schedule |
| 74 |
Messages = Standard |
| 75 |
FileSet = cdp |
| 76 |
} |
| 77 |
\end{bVerbatim} |
| 78 |
|
| 79 |
\subsection{CDP Client Configuration} |
| 80 |
|
| 81 |
\begin{bdescription} |
| 82 |
\item [-f \bbracket{dir}] watches the directory \bbracket{dir} for changes |
| 83 |
\item [-j \bbracket{dir}] sets journal directory to \bbracket{dir}. Default value is \bdefaultvalue{\bbracket{HOME}} |
| 84 |
\item [-s \bbracket{dir}] sets spool directory to \bbracket{dir}. Default value is \bdefaultvalue{\bbracket{HOME}/.cdp-sdir} |
| 85 |
\item [-d \bbracket{nn}] set debug level to \bbracket{nn} |
| 86 |
\item [-h] print help |
| 87 |
\end{bdescription} |
| 88 |
|
| 89 |
\subsection{Tray Monitor Configuration} |
| 90 |
|
| 91 |
You can setup the folders you wish to watch for changes by using the Tray Monitor. |
| 92 |
|
| 93 |
Open the Tray Monitor options and click in the option \bhighlight{Watch\ldots{}}: |
| 94 |
|
| 95 |
\bimageH |
| 96 |
{cdp-image1}{Open \acs{CDP} Client}{blb:fig:cdp-image1.png} |
| 97 |
|
| 98 |
You should see a window displaying the watched folders. Click in the button \bhighlight{Add}: |
| 99 |
|
| 100 |
\bimageH |
| 101 |
{cdp-image2}{CDP Client Window}{blb:fig:cdp-image2.png} |
| 102 |
|
| 103 |
Select the folder you wish to watch: |
| 104 |
|
| 105 |
\bimageH |
| 106 |
{cdp-image3}{Watching a Folder}{blb:fig:cdp-image3.png} |
| 107 |
|
| 108 |
You should see the watched folder listed, as in the image below: |
| 109 |
|
| 110 |
\bimageH |
| 111 |
{cdp-image4}{Result}{blb:fig:cdp-image4.png} |
| 112 |
|
| 113 |
\subsection{The Spool Directory and Scheduled Backups} |
| 114 |
|
| 115 |
The Spool Directory contains all files from the watched folders |
| 116 |
that were created and / or changed. It keeps a copy of every version of |
| 117 |
the files. |
| 118 |
|
| 119 |
An example of this directory can be seen below: |
| 120 |
|
| 121 |
\bimageH |
| 122 |
{cdp-image7}{Result}{blb:fig:cdp-image7.png} |
| 123 |
|
| 124 |
You must schedule backup jobs with a proper Files in order to backup those files with Bacula. |
| 125 |
Following this example, the job configuration would be: |
| 126 |
|
| 127 |
\begin{bVerbatim} |
| 128 |
FileSet { |
| 129 |
Name = cdp |
| 130 |
Include { |
| 131 |
Options { |
| 132 |
compression = LZO |
| 133 |
} |
| 134 |
Plugin = "cdp: userHome=/home/user1" |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
Job { |
| 139 |
Name = CDP |
| 140 |
Client = myclient-fd |
| 141 |
Type = Backup |
| 142 |
Pool = Default |
| 143 |
Schedule = Hourly # Choose a schedule |
| 144 |
Messages = Standard |
| 145 |
FileSet = cdp |
| 146 |
} |
| 147 |
\end{bVerbatim} |
| 148 |
|
| 149 |
The Job reads the journal file to select which files from the Spool Directory |
| 150 |
should be backed up. After that, the files will be available to be restored at any time: |
| 151 |
|
| 152 |
\bimageH |
| 153 |
{cdp-image8}{Job Files}{blb:fig:cdp-image8.png} |
| 154 |
|
| 155 |
\subsection{Important} |
| 156 |
|
| 157 |
It's necessary to keep either the \btool{cdp-client} or the \btool{tray-monitor} running in order to |
| 158 |
protect the directories being watched. |
| 159 |
|
| 160 |
\subsection{Limitations} |
| 161 |
|
| 162 |
\begin{bitemize} |
| 163 |
\item There is a limit in the number of folders that can be watched by default, which varies |
| 164 |
depending on your Operating System. You can increase that number by checking the correct |
| 165 |
procedure for your Operating System. |
| 166 |
\item On Linux OSes, the CDP client implementation relies on the \bhighlight{inotify API}, therefore being subject |
| 167 |
to it's limitations (for example, it doesn't work with NFS). On Windows, the client relies on the |
| 168 |
\bhighlight{ReadDirectoryChangesW API}. |
| 169 |
\end{bitemize} |