How to Get Started with Bacula Enterprise and Cloud Storage

By | October 29, 2016

Introduction

This article and the image have been created by a joint effort between Bacula Systems S.A, bytemine GmbH, and ProfitBricks GmbH.

We offer an image with a basic Bacula install that should cover everything you need to get started with Bacula Enterprise and cloud storage. We will show you how use Bacula to build a proper and solid backup environment.

This guide is intended to show you around and give some basic examples on how to use Bacula and how to extend your setup. We mainly use Bweb Management Suite in this guide.

Create and start your Bacula server

Get your Bacula Server running in three steps:

  1. Create a Server in the Data Center Designer and attach two storage volumes. The second storage volume will be automatically integrated by the Bacula server and is used as a backup repository. Recommended size for the storage volumes:
    • Volume 1: 30 GB
    • Volume 2: 100 GB or bigger according to your backup needs.
  2. Assign the image bacula_server$ to the first hard disk.
  3. Provision the server. The password of the bweb interface can be found in the /root directory in the file new-bweb-password

Once your system is set up, point your browser to:

http://[your IP address]:9180/bweb

Bacula Enterprise overview

Bacula Enterprise has five main components:

  1. The Director: Supervises all the backup, restore, verify and archive operations.
  2. The Storage Daemon: Performs the storage of the file attributes and data to the physical backup media.
  3. The File Daemon or Client: Installed on each machine to be backed up.
  4. The Catalog: Maintains the file indexes for all files backed up.
  5. The Console: Allows users to interact with the Director. The console is available in two versions:
    • Bconsole: Text-based console interface.
    • BWeb Management Suite: Web interface.

Bacula Enterprise architecture

It is important to understand some of the basic Bacula architecture and terminology before setting up and using your backup environment, as it will ease your task and will avoid future mistakes.

All of the terms used are explained in the concept guide available here.

If you want to dig deeper check out the main manual available here.

Managing your Bacula setup

There are multiple ways to manage your Bacula setup.

For some administrators the bconsole, a text-based console interface, is the way to go.

However in this guide, we will mostly cover the Bweb Management Suite, as it is a good way to start if you are new to Bacula.

Bweb Management Suite is a web interface that interacts with the Director and offers tools to run backup and restore jobs, to monitor and to configure your Bacula infrastructure.

Bweb also offers a lot of help feautures. If you ever get lost, click on one of the help buttons.

Worksets

Bacula uses worksets to track the configuration changes you make. Any time you make a change, it needs to be committed in order to go live.

If you discover that you made a mistake during your configuration, you can clear your workset and start over.

The workset is available at Configuration –> Configure Bacula.Bacula workset

Backup a Linux client with Bweb Management Suite

We will begin by configuring and creating your first backup.

Go to Configuration –> Configure Bacula –> Clients.

As you can see there is already a Bacula client, bacula-fd which has been configured.

There are also some default jobs defined.

To start a job for our bacula-fd, in the main menu go to Jobs –> Defined Jobs. Choose the job you want to start from the drop-down menu.

Defined jobs

Let’s choose the /usr directory. Click on the Run now button.

Another drop down menu will appear. Choose the default values and click Run now again.

You will be taken to the running job information window. You can click Refresh to watch the progress.

Running job information window

Once the job is complete, an automatic refresh will take you to the job report window, where you can see the outcome of the backup job.

You can also find this information by going to Jobs –> Jobs History and clicking on the status icon.

Adding a new backup client

In our next example we’ll add a new client and configure everything needed for a valid backup. The first step is to install the client software and make it accessible.

Installing a file daemon

Bacula file daemons, called bacula-fd, exist for almost all platforms.

We provide a cd image, available in the image section of your datacenter, which can be mounted onto your server.

Add a cd-rom drive, available in the storage section of your server and assign the “bacula-agent-client.iso” to the cd-rom drive. You need to provision your changes for this to be made available.

On windows systems the cd-rom drive will automatically be detected and mounted. You can now browse the image, choose the required version, execute the installer package and follow the instructions.

On Linux systems the following steps have to be taken:

Mounting the Image

mkdir /mnt/bacula-clients 
mount -o ro /dev/cdrom /mnt/bacula-clients/

debian based systems:

Example for an Ubuntu14.04 system:

dpkg -i /mnt/bacula-clients/8.2.7/trusty-64/bacula-enterprise-common_8.2.7-1_amd64.deb
dpkg -i /mnt/bacula-clients/8.2.7/trusty-64/bacula-enterprise-client_8.2.7-1_amd64.deb
apt-get install -f

redhat based systems:

Example for a Centos7 system:

rpm -i /mnt/client-installer/8.2.7/rhel7-64/bacula-enterprise-libs-8.2.7-1.el7.x86_64.rpm
rpm -i /mnt/client-installer/8.2.7/rhel7-64/bacula-enterprise-client-8.2.7-1.el7.x86_64.rpm

suse based systems:

Example for a SLES12 system:

rpm -i /mnt/client-installer/8.2.7/sles12-64/bacula-enterprise-libs-8.2.7-1.su120.x86_64.rpm
rpm -i /mnt/client-installer/8.2.7/sles12-64/bacula-enterprise-client-8.2.7-1.su120.x86_64.rpm

DNS

Be aware that your clients have to be able to resolve the bacula-director via the hostname “bacula”. This can be achieved by adding a DNS ‘A’ record pointing to the IP address of the Director to your own domain name server, or by adding an /etc/hosts entry on your clients.

When adding the client in bweb you have to specify an address where the client is reachable within your network. You can specify an ip address or a fqdn like bacula-client.example.org.

When using a fqdn make sure this is resolvable from your bacula-director.

Firewalling

The bacula-director has to be able to reach the bacula-fd at tcp port 9102. On windows machines this will be blocked by default, if the windows firewall is active.

And your bacula-fd has to be able to reach the bacula storage daemon (bacula-sd) at port 9103. Keep this in mind when putting your system into production.

Overall needed firewall rules:

bacula-dir -> bacula-sd:9103
bacula-dir -> bacula-fd:9102
bacula-fd  -> bacula-sd:9103

Configuring the file daemon

Go to Configuration –> Configure Bacula.

On the left hand side you will find wizards to help you in adding a variety of resources.

Click on Add a new Client resource. The wizard will guide you through the next steps.

Configure a new client resource pop-up 1Configure a new client resource pop-up 2

If yout want to use TLS Encryption for your backups, choose the appropriate certificate(s).

The Bweb Management Suite also offers a wizard for the creation of these certificates at Configuration –> Configure Bacula –> Security Center.

However in our example we will leave this one out.

Configure a new client resource pop-up 3

The wizard will generate the configuration for your client (file daemon).

There are two ways to get this configuration onto your client:

  1. Copy and paste the output into the bacula-fd.conf of the machine that is going to be backed up.
  2. Use Bweb Management Suite’s “push configuration” option. Click on edit and deploy this newly created FileDaemon Resource.

Note: Make sure the client is accessible via password or public-key authentication if you plan on using this.

Configure a new client resource pop-up 4Configure a new client resource pop-up 5

Once this is done go to Workset and commit your changes.

Fileset customization

To show some more of the flexibility Bacula offers we will apply a new fileset for your newly created file daemon.

One potential issue is the availability of backup space. For a Linux client it is possible to backup everything starting at the root directory /.

But do we need all that data?

Many files will be the same, for example if you use the same Linux distribution on several servers.

In most cases this doesn’t matter as we use the deduplication plugin. But if you have a specific server where you need to backup a large amount of data (e.g. everything in /opt) you should start by adding a new fileset.

In the base setup we have defined a job for /usr.

Now we will do the same for /opt.

Using the Bweb Management Console, navigate to Filesets and click on Add a new fileset resource:

Enter a name for the fileset and an optional description.

Create a new fileset resource pop-up 1

On the next screen you will be prompted with a wide variety of options, in our example we will choose:

Yes – backup all Client content followed by No – Select paths and files

Create a new fileset resource pop-up 2

Adjust the config snippet so it looks like the one in the screenshot below and click on Save.

Create a new fileset resource pop-up 2

Creating a database backup

MySQL

Backing up a database is a little more complicated than backing up a filesystem.

Bacula Enterprise has many plugins which can be used. In this example we will take a closer look at the MySQL and the MSSQLplugin.

Begin by creating a new fileset. Choose the MySQL plugin in the list down below.

Fill out the needed information and create the needed permissions and users on your backup client.

MySQL plugin pop-up 1MySQL plugin pop-up 1

Next, create the job.

MSSQL

For Windows systems, Bacula Enterprise uses Volume Shadow Copy Service (VSS) to ensure file system consistency.

Begin by creating a new fileset. Choose the Microsoft VSS MSSQL in the list down below.

Fill out the needed information and create the needed permissions and users on your backup client.

MSSQL plugin pop-up 1

More info on database backups and restoring them can be found here.

Create the job

Next, create and configure a new job resource to use the new fileset.

Go to Configuration –> Configure Bacula and on the left hand side choose Add a new Backup.

Create new job pop-up 1Create new job pop-up 2Create new job pop-up 3Create new job pop-up 4Create new job pop-up 5

After that you will be prompted with more configuration options the newly created job. You can still edit some of the available options.

If everything fits your need, click Save.

Edit job opt

Restore files on a Linux Client using Bweb Management Suite

From the main menu go to Jobs –> Web Restore.

Select the client in the Select a client… list and job in the Select a job… list.

The directory tree will automatically show up on the directories panel.

Restore files 1

In the directories panel, browse to /usr/bin/.

The content will show up in the panel directory content.

Highlight some or all of the files in /usr/bin, and drag them to the restore selection panel located below.

Restore files 2

Click Run Restore.

Restore files 2

A Restore Selection pop-up will appear.

Note: By default, your recovered files will be sent to /tmp/bacula-restores/ using the value in the Where field.

You can change this to a different path or client if you already have multiple clients configured.

Click on Run to start the job. You will be redirected to a status window. Click the Refresh button to see a green status bar that will show the job progress.

Restore files 3

When the restore is successful, you will be redirected to a job status window.

To check for the restored files, e.g. ssh to the bacula-client,change to the path you selected in the restore process, and list the contents.

Example: Backing up a directory with BConsole

This will show you how to use BConsole, a text based console interface used to interact with the Director, to run backup and restore jobs and to monitor your Bacula infrastructure.

To access BConsole, log on your server directly or via ssh.

This scenario uses the folder /home/bacula located on your server.

First, create a 200Mb file with random data which we will use as an example:

dd if=/dev/urandom of=/home/bacula/random.log bs=100M count=2

Next, enter bconsole:

/opt/bacula/bin/bconsole

In the console, type run and hit Enter.

Select the job labeled home by typing the number in front of it.

Review the job settings. Note that this job is an incremental one. You may modify parameters at run time, but in this case just type yes to start the job.

Backup with bconsole 1

You should be returned to the prompt and given an indication that the job has been queued, like Job queued. JobId=x.

To view the status of the job, type status dir.

You might see the job listed under Running Jobs or under Terminated Jobs if it is already finished. You can also see scheduled jobs and jobs which were completed in the past.

You can review the job log at any time by using the messages command.

You should now have a full backup of your /home/bacula folder. The next step is to restore this data to the default restore location, currently the folder /tmp/bacula-restores/.

Example: Restoring files with BConsole

In this scenario we are restoring data from an existing backup folder from /home/bacula which we backed up in the previous example.

Simply enter restore.

Here you will see the different ways to find what you want to restore. Type 5, which will select the last backup job run. Note that your backup client is automatically selected since there is only one client available.

Here you will see all data sets that have been run. Select the fileset labeled home by typing the number before home to select that folder.

When you hit Enter, Bacula Enteprise Edition will build a file tree from the catalog. This will let you browse through and choose the files you want to restore.

Many standard commands are available such as ls to list the directory, and cd to change directories.

To restore /home/bacula begin with:

cd /home/bacula

Type the command:

mark *

That will mark the contents of the directory for restore.

Restore from bconsole 1

When you are done selecting files and folders, type done.

Review the job settings, most importantly the Where and Restore Client directives. We can leave these alone for now, but if you ever want to restore to a different location or another client machine, here is one way to accomplish it.

Type yes to run the restore job.

To view the status of the job, type status dir.

Type messages in BConsole to review the job log. Run the messages command periodically to check the status.

When the job is complete, you will see Restore OK.

Type exit to close BConsole.

Сomments аrchive