Bacula BackUp Server
Transcription
Bacula BackUp Server
Bacula BackUp Server Einrichten eines Bacula BackUp Servers Version: 1.2 Bacula BackUp Server Datum: 02.05.2016 Inhaltsverzeichnis Inhaltsverzeichnis ................................................................................................................ ii 1 Introduction ................................................................................................................. 3 2 Create and start your Bacula server ............................................................................... 3 3 Bacula Enterprise overview ........................................................................................... 3 4 Managing your Bacula setup.......................................................................................... 5 5 Worksets ...................................................................................................................... 5 6 Backup a Linux client with Bweb Management Suite ...................................................... 5 7 Adding a new backup client ........................................................................................... 6 7.1 Installing a file daemon ................................................................................................ 7 7.2 Mounting the Image ..................................................................................................... 8 7.3 DNS ............................................................................................................................. 8 7.4 Firewalling ................................................................................................................... 8 7.5 Configuring the file daemon .......................................................................................... 9 8 Fileset customization .................................................................................................. 11 8.1 But do we need all that data? ...................................................................................... 11 9 Creating a database backup ........................................................................................ 13 9.1 MySQL ........................................................................................................................ 13 9.2 MSSQL........................................................................................................................ 14 9.3 Create the job............................................................................................................. 15 10 Restore files on a Linux Client using Bweb Management Suite...................................... 18 11 Example: Backing up a directory with BConsole ........................................................... 19 12 Example: Restoring files with BConsole ....................................................................... 21 13 License and contact information .................................................................................. 22 ii 2 Bacula BackUp Server 1 Datum: 02.05.2016 Introduction 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. 2 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 3 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. Seite 3 von 21 Bacula BackUp Server Datum: 02.05.2016 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. If you want to dig deeper check out the main manual available here. Seite 4 von 21 Bacula BackUp Server 4 Datum: 02.05.2016 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. 5 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. 6 Backup a Linux client with Bweb Management Suite We will begin by configuring and creating your first backup. Go to Configuration Configure Bacula Clients. Seite 5 von 21 Bacula BackUp Server Datum: 02.05.2016 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. 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. 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 7 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. Seite 6 von 21 Bacula BackUp Server Datum: 02.05.2016 7.1 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-agentclient.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: Seite 7 von 21 Bacula BackUp Server Datum: 02.05.2016 7.2 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 7.3 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. 7.4 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. Seite 8 von 21 Bacula BackUp Server Overall needed firewall rules: bacula-dir -> bacula-sd:9103 bacula-dir -> bacula-fd:9102 bacula-fd -> bacula-sd:9103 7.5 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. If yout want to use TLS Encryption for your backups, choose the appropriate certificate(s). Seite 9 von 21 Datum: 02.05.2016 Bacula BackUp Server Datum: 02.05.2016 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. 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. Seite 10 von 21 Bacula BackUp Server Datum: 02.05.2016 Once this is done go to Workset and commit your changes. 8 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 /. 8.1 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. 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 Seite 11 von 21 Bacula BackUp Server Datum: 02.05.2016 Adjust the config snippet so it looks like the one in the screenshot below and click on Save. Seite 12 von 21 Bacula BackUp Server 9 Datum: 02.05.2016 Creating a database backup 9.1 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 MSSQL plugin. 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. Seite 13 von 21 Bacula BackUp Server Datum: 02.05.2016 Next, create the job. 9.2 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. Seite 14 von 21 Bacula BackUp Server Datum: 02.05.2016 More info on database backups and restoring them can be found here. 9.3 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. Seite 15 von 21 Bacula BackUp Server Seite 16 von 21 Datum: 02.05.2016 Bacula BackUp Server Datum: 02.05.2016 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. Seite 17 von 21 Bacula BackUp Server Datum: 02.05.2016 10 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. 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. Click Run Restore. Seite 18 von 21 Bacula BackUp Server Datum: 02.05.2016 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. 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. 11 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 Seite 19 von 21 Bacula BackUp Server Datum: 02.05.2016 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. 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/. Seite 20 von 21 Bacula BackUp Server Datum: 02.05.2016 12 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. 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. Seite 21 von 21 Bacula BackUp Server Datum: 02.05.2016 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. 13 License and contact information In order to buy licenses, please contact: bytemine GmbH mail: sales@bytemine.net phone: +49441309197-69 Seite 22 von 21