make check_archive transactionally safe
[BackupPC.git] / README.ASA
1 This document tries to describe ASA extensions for BackupPC 3.2.0
2
3 Written by Dobrica Pavlinusic <dpavlin@rot13.org> 2011-01-27
4
5 This is second iteration of adding search over arbitrary filename substrings and archive
6 to CD/DVD media with tracking of copies and additional md5sum creation on them for easy
7 burned media verification.
8
9 ASA maintains it's data in PostgreSQL and KinoSearch (for faster part-of-filename matching).
10 Since full-text search is single-writer, we need to serialize somehow requests for it's update.
11
12 Implementation is based on archive host feature in BackupPC using _search_archive.pl configuration
13 file located at /etc/BackupPC/pc/_search_archive.pl
14
15 This provides us with serialization and hooks around it, but lacked incremental tar creation which
16 is essential because we want to burn always increasing archive on CD/DVD media.
17
18 This is implemented using new global configuration directive TarCreateIncremental
19
20 Using BackupPC hooks to integrate and archive host also provided following advantages:
21         - web interface for archive host contains our log messages
22         - all updates are invoked automatically on end of each run (system is always up to date)
23
24 BackupPC can dump multiple machines in parallel, this invoking our _search_archive host and index
25 update while update from different machine is still in process. Archive host will reject request,
26 but next invocation of same host will fix problem automatically.
27
28 To be sure that all pending archives are indexed, you can also run cron job which invokes _search_archive
29 on all pending increments:
30
31         /BackupPC_ASA_ArchiveStart _search_archive backuppc
32
33 You can also force archival of particual pending backups from single host by adding hostname(s) or
34 hostname:num to backup individual increment.
35
36 Alternativly, you can use _search_archive web interface to invoke increment creation and indexing.
37
38
39
40 There are two global options which had to be set for all hosts:
41
42 #
43 # /etc/BackupPC/config.pl
44 #
45
46 # invoke archive of dump - ASA extension DumpPostCmd was too early
47 $Conf{DumpPostFinishCmd} = '/srv/BackupPC/bin/BackupPC_ASA_ArchiveStart _search_archive backuppc $host';
48
49 # dump only incremental changes in tars not whole content - ASA extension
50 $Conf{TarCreateIncremental} = 1;
51
52
53
54 You can manually trigger all pending backups using:
55
56         BackupPC_ASA_ArchiveStart _search_archive backuppc
57
58 This will start archive host _search_archive which will run it's configuration:
59
60 #
61 # /etc/BackupPC/pc/_search_archive.pl
62 #
63
64 # Set this client's XferMethod to archive to make it an archive host:
65 $Conf{XferMethod} = 'archive';
66
67 # The path on the local file system where archives will be written:
68 $Conf{ArchiveDest} = '/data/BackupPC/_search_archive';
69
70 # the type and level of compression used on the archive:
71 $Conf{ArchiveComp} = 'gzip';
72 $Conf{CompressLevel} = 9;
73
74
75 # archive media size (in bytes) 4.2Gb for DVD
76 #$Conf{ArchiveMediaSize} = 4200 * 1024 * 1024; # DVD
77 $Conf{ArchiveMediaSize} =  630 * 1024 * 1024; # CD
78 #$Conf{ArchiveMediaSize} =        1440 * 1024; # floppy
79 #$Conf{ArchiveMediaSize} =   42 * 1024 * 1024; # FIXME
80
81
82 # A size in megabytes to split the archive in to parts at.
83 # This is useful where the file size of the archive might exceed the
84 # capacity of the removable media. For example specify 700 if you are using CDs.
85 #$Conf{ArchiveSplit} = 650;
86 $Conf{ArchiveSplit} = 100; # FIXME small testing chunks
87
88
89 # The amount of parity data to create for the archive using the par2 utility.
90 # In some cases, corrupted archives can be recovered from parity data.
91 $Conf{ArchivePar} = 30;
92 $Conf{ParPath} = '/srv/par2cmdline-0.4-tbb-20100203-lin64/par2';
93 # http://chuchusoft.com/par2_tbb/download.html
94 # par2cmdline 0.4 with Intel Threading Building Blocks 2.2
95
96 # use parallel gzip (speedup on multi-code machines)
97 $Conf{GzipPath} = '/usr/bin/pigz';
98
99
100 # The full command to run to create archives:
101 $Conf{ArchiveClientCmd} = '$Installdir/bin/BackupPC_archiveHost'
102 . ' $tarCreatePath $splitpath $parpath $host $backupnumber'
103 . ' $compression $compext $splitsize $archiveloc $parfile *';
104
105 # host provides serialization, so we can safely update fulltext index
106 $Conf{ArchivePreUserCmd} = '/srv/BackupPC/bin/BackupPC_ASA_SearchUpdate -h$HostList';
107
108 $Conf{Md5sumPath} = '/usr/bin/md5sum';
109
110 # after archives are created, pull data back in database - ASA extension
111 $Conf{ArchivePostUserCmd} = '/srv/BackupPC/bin/BackupPC_ASA_PostArchive_Update -h$HostList -n$BackupList';
112
113 # Logging verbosity:
114 $Conf{XferLogLevel} = 1;
115
116
117