Bareos, ZFS and Puppet: Christian Reiß Symgenius

Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

Bareos, ZFS and Puppet

Christian Reiß
Symgenius
About Me

● Christian Reiß
● 37 years old
● System Administrator at Symgenius

2
About Me

● Linux since 1995'ish (Kernel 1.3)


● B* evangelist
● Love Puppet

3
Agenda

● Motivation and a little(!) history,


● Bacula (Alternatives),
● ZFS Introduction,
● The Puppet Module.

4
A Promise

● I’ll try to do an ‘easy listening’,


● No code snippets.

5
About Symgenius

● Symgenius
● Brand ‘Power-Netz.de’

● Mid sized hosting company,


● Usual web-stack,
● Project hosting and housing
6
Motivation – The situation

● We do webhosting.

● Several hundred Servers,


● Several hundred Customers each,

● Thousands of files per webhost,


● Thousands of files per Maildir,
● And of course: mysql.
7
Motivation - History

● We used to backup with tar,


● Full backups of root into a tar located
on a nfs share,
● Incrementals with a “find -ctime 1”.
● Everything piped through
compression, ie. pigz or pbzip2.

8
Motivation - History

● It did it’s job.

● Compression on client-side,
● Monitoring was a nightmare,
● But Restoring was hell.

9
Motivation - Alternatives

We tried several alternatives:

● BackupPC
● Rsnapshot
● Rsnapshot + ZFS Snaps
● Bacula

10
Motivation - Alternatives

● BackupPC and rsnapshot failed.


● Backup times were 13+ hours due to
amount of files,
● Job deletion even took longer.
● Backup + Job deletion exceeded 24
hours → Daily jobs piled up.

11
Enter Bacula

Bacula solved several issues:

● Backups are blazing fast even with


high file counts,
● Backups are written inside a single
archive volume,
● Restoring is bliss.

12
Enter Bacula

… But also:

● No heavy CPU load on client side


(think compression)
● You could do Backups during work
hours without Clients noticing (Well,
except for MySQL Dumps…).

13
Enter Bacula

Client issue is solved,


but what about the server side?

14
Enter Bacula

The Server needs:

● Protection against Hardware faults:


- RAID(-alike)
- Bit-Rot
● Other things:
- Transparent compression
- Quotas per Server
15
Enter Bacula

Also:

● Should be hassle- and maintenance


free (mostly).
● Needs to perform fast on ‘normal’
Hardware.

16
ZFS - Overview

All is solved with ZFS

17
ZFS - Overview

All is solved with ZFS


and Bareos.

18
ZFS - Features

The features of ZFS include:


● […] protection against data
corruption,
● continuous integrity checking and
automatic repair [...]

19
ZFS - Features

The features of ZFS include:


● […] RAID-Z [...]

20
ZFS - Features

The features of ZFS include:


● […] support for high storage
capacities, [...]

21
ZFS - Features

The features of ZFS include:


● […] efficient data compression, [...]

22
ZFS - Features

The features of ZFS include:


● […] snapshots and copy-on-write
clones, [...]

23
ZFS - Availability

Apart from Sun OS ZFS is available

● In Ubuntu 16.04 and up,


● In (future) Debian releases,
● And for all other Distributions via
zfsonlinux.org.
● FreeNAS using ZFS as main storage

24
ZFS - Install

● You install the package for your OS,


● Reboot,
● You do a “zpool create”,
● You might want to “zfs set” some
stuff,
● Done.
This does not count as ‘code snippet’.

25
ZFS – Live Example

Our SD (also Dir) consists out of:

● Intel Xeon CPU L5420 @ 2.50GHz


● 8 total cores
● 32gb Memory
● SSD for System and MySQL Data,
● 22x 4TB ‘NAS Grade’ WD Reds.
● (currently) 1Gb NIC
26
ZFS – Live Example

We backup 35 servers simultaneously.


Both the CPU and NIC are maxed.

That’s ~900Mbit of data transparently


compressed, RAID’ed and
checksummed right there.

With 8 cores.
27
ZFS – System Load

28
ZFS – Live Example

[root@bertha d125.power­netz.de]# pwd
/bacula/storage/d125.power­netz.de
[root@bertha d125.power­netz.de]# df ­h . 
Filesystem               Size  Used Avail Use% Mounted on
bacula/d125.power­netz.de  4.0T  992G  3.1T  25%  
                          /bacula/storage/d125.power­netz.de

29
ZFS – Live Example

[root@bertha d125.power­netz.de]# ls ­lhat
total 992G
drwxr­x­­­ 268 bacula bacula  268 Jul 27 15:05 ..
­rw­r­­­­­   1 bacula bacula  12G Jul 27 01:43 d125­daily­1420
­rw­r­­­­­   1 bacula bacula  13G Jul 26 01:20 d125­daily­1274
­rw­r­­­­­   1 bacula bacula  11G Jul 25 01:56 d125­daily­1119
­rw­r­­­­­   1 bacula bacula  44G Jul 24 02:17 d125­weekly­1932
­rw­r­­­­­   1 bacula bacula  14G Jul 23 01:26 d125­daily­0980
[...]
­rw­r­­­­­   1 bacula bacula  31G Jul 17 01:38 d125­weekly­0828
­rw­r­­­­­   1 bacula bacula  13G Jul 16 01:09 d125­daily­0309
[...]
­rw­r­­­­­   1 bacula bacula 362G Jul 11 05:10 d125­monthly­5778
­rw­r­­­­­   1 bacula bacula  64G Jul  9 01:56 d125­weekly­4000
­rw­r­­­­­   1 bacula bacula  56G Jul  2 01:33 d125­weekly­3312
­rw­r­­­­­   1 bacula bacula  45G Jun 24 01:13 d125­weekly­2846
­rw­r­­­­­   1 bacula tape   359G Jun 11 04:38 d125­monthly­3633

30
ZFS – Live Example

[root@bertha ~]# zfs get compressratio
NAME                       PROPERTY       VALUE
[...]
bacula/d136.power­netz.de    compressratio  1.79x  
bacula/d137.power­netz.de    compressratio  1.69x  
bacula/d138.power­netz.de    compressratio  2.10x  
bacula/d139.power­netz.de    compressratio  1.57x  
[...]

31
ZFS – Live Example

[root@bertha d125.power­netz.de]# du ­h d125­monthly­3633 ­­apparent­size

359G d125­monthly­3633

[root@bertha d125.power­netz.de]# du ­h d125­monthly­3633

264G d125­monthly­

Net Save of 95GB, that’s ~30%!

32
ZFS – Live Example

On a sidenote:

Deduplication does not work.

33
ZFS - Advantages

● No more RAID controllers,


● Defense against Bit-Rot,
● Defense against Drive Faults*,
● Compression is done on Server,
● Quotas are possible,
● No hacks or workarounds.
● Everything is done transparently!
34
ZFS / Puppet

Puppet.

35
Puppet Module

The module does the usual:

● It configures the director,


● The storage daemon
● And of course the FD’s.

→ Backups work :)
36
Puppet

Each Server has:

● An independent Pool for Full Backups,


● An independent Pool for Differentials,
● An independent Pool for Incrementals.

In its own ZFS-Dataset.

37
Puppet

Each Server:

● Has limited bconsole shell access


(using ACL's)
● Has its own device in bacula-sd
● Is fully monitored by Icinga/Nagios

38
Puppet

● We wanted a fully automated System

● Non-destructive Installation

● Managing new Servers, adding ZFS


● Soft removal of retired Servers

39
Puppet Module

In addition to that:

● One-File-per-Job (Volume)
● Monitor last Backup,
● Monitor MySQL Dumps,
● We check for a valid full-backup,
● We check for /bacula-restores dir.

40
Puppet Module

… Also:

● Random Passwords generated


● bareos-fd.conf copy saved on dir
● Option to override IPs

41
Puppet Module

Set & override by hiera:

● Accurate flag (default yes),


● Exclude of files,
● Include of files,
● Onefs flag (default yes).

42
Puppet

43
Puppet Module

… and of course it will install the webui!

44
The End.

Thank you for your attention! \o/

45
The End.

As promised:

Bareos-Puppet Module available:


https://github.com/christianreiss/al_bareos

Contact me via:
[email protected]

Questions?
46

You might also like