Here is a brief tutorial on how I have set up the powerful Bacula backup tool on a server supporting a split-backup environment:
- Daily backups are made on NIC 1 to a local network storage facility (hosted by a Bacula backup server)
- On-demand backups are pulled via NIC 2 across a public network channel - e.g. VPN link - to a complete off-site storage facility (hosted by another Bacula backup server)
An extra limitation exists in the fact that the on-demand backups suffer a metering charge, one that based on a maximum allowed throughput per time unit, say 10 mbits/s. It is therefore important that any Bacula backup run stays well below that traffic threshold. Unless you are running an Entreprise version of Bacula, it will be impossible to instruct Bacula to throttle its communication between client (bacula-fd) and server (bacula-dir). This is where the nifty Trickle software comes into play.
From its man page:
trickle is a user space bandwidth manager. Currently, trickle supports the shaping of any SOCK_STREAM (see socket(2)) connection established via the socket(2) interface. Furthermore, trickle will not work with statically linked executables, nor with setuid(2) executables. trickle is highly configurable; download and upload rates can be set separately, or in an aggregate fashion.*
By running the Bacula file daemon (aka client) under supervision of trickle, it is possible to limit the client daemon’s bandwith to a certain level.
For example (from
which would limit Bacula I/O to 500KB/s (+/- 4mbit/s). This way we will never exceed the 10mbit/s threshold, at least not by just running a Bacula backup. Next, I wanted to make sure that only the external backup was throttled by trickle. Limiting the throughput on the internal network does not make any sense and would only artificially prolong any backup run. The clue in achieving this is to have two separate bacula client (file daemons) running: one bonded to NIC1 powering the local backups; the other bonded to NIC 2 and powering the external backups. In order to support two separate bacula client daemons, we need two separate configuration files:
/etc/bacula/bacula-fd-internal.conf: the configuration file that will drive the backups across the internal network
/etc/bacula/bacula-fd.conf: the (standard) configuration file that will drive the backups across the external network
Before all: stop the currently running bacula-fd process and make a copy of the original
bacula-fd.conf configuration file:
bacula-fd.internal.conf configuration file needs a directive telling the internal bacula-fd process to bond to NIC 1, e.g.:
where backup.master is the locally resolvable DNS name of the internal Bacula backup server. You may prefer to use the IP address instead of a DNS name. Additionally, we want to be sure that this Bacula client connects only to the Bacula server (directory) on the local network. For this, a dedicated Director resource needs to be configured, e.g.:
Choose a different working & PID directory to avoid conflicts between both client daemons (do not forget to pre-create these directories!):
bacula-fd.conf configuration file requires a similar change:
where backup.master is the externally resolvable DNS name of our external Bacula backup server. You may prefer to use the IP address instead of a DNS name.
Like the internal Bacula client, we also want to be sure that this Bacula client connects only to the Bacula server (directory) on the external network. For this, a dedicated Director resource needs to be configured, e.g.:
These steps complete the setup of the Bacula application itself. The final to-do is to take care of the 2 processes starting and stopping independently and the internal backup client having its traffic throttled by trickle.
Note 1: the following guidelines are based on system init scripts as found on RHEL/CentOS distrubutions. If you are are running any other flavour of GNU Linux/Unix, then your mileage may vary. First, we undouble the standard bacula-fd daemon program in
/usr/sbin by creating a hard link to the original binary:
Note 2: Using a soft (symbolic) link will not work in this case, as it will cause both bacula client processes to be stopped at the same time by either of the
/etc/init.d scripts. Secondly, we undouble the standard bacula-fd init scripts in
/etc/init.d/bacula-fd.internal.conf to include references to the new configuration file and binary:
/etc/init.d/bacula-fd.conf to include the trickle command:
Restart both Bacula client daemons and verify their correct operation by issuing a
check from their respective Bacula directors. If you run into problems then verify whether the Bacula client daemons are actually bonded to the right network card:
You may also need to adjust your firewall settings. Again YMMV.
Note: You can check the actual bandwidth usage by Bacula if you install a real-time bandwidth measuring tool like bwm-ng. Here is a sample output of bwm-ng: