aboutsummaryrefslogtreecommitdiff
path: root/doc/beam.conf.5in
blob: 9462035675c660451e882c72abe5f5f88fc2add5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
.\" This file is part of BEAM -*- nroff -*-
.\" Copyright (C) 2012-2014 Sergey Poznyakoff
.\"
.\" BEAM is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 3, or (at your option)
.\" any later version.
.\"
.\" BEAM is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with BEAM.  If not, see <http://www.gnu.org/licenses/>.
.\"
.TH BEAM.CONF 5 "March 18, 2014" "BEAM" "BEAM User Reference"
.SH NAME
beam.conf \- configuration file for
.B BEAM
.SH DESCRIPTION
The \fBbeam.conf\fR file defines what data are to be included in the
backup, what backup methods to use and where to store the resulting
archives.  The 
.BR backup (1)
and
.BR restore (1)
utilities expect to find it in the
.B @SYSCONFDIR@
directory.
.SH SYNTAX
The file is essentially a shell script that defines variables
controlling backup and restore procedures.  Names of the variables
used by the backup scripts begin with
.BR backup_ .
.SH GENERAL SETUP
.TP
.BR backup_umask = \fIMASK\fR
Sets file mode creation mask.  This mask will apply to all files
created during the backup: archives, snapshots and temporary files.
The default mask is
.BR 077 .
.TP
.BR backup_tmp_dir = \fIDIR\fR
Sets the directory where temporary files will be stored.  The default
is
.BR /tmp .
.TP
.BR backup_logfile = \fIFILE\fR
If set, redirect standard error and standard output to that file.  The
file will be created if it does not exist.  Otherwise, the output will be
appended to it.

By default, this file will be automatically rotated.  See 
.B openlog_hook
below for a discussion of this.
.TP
.BR backup_logrotate_conf = \fITEXT\fR
Configuration text for
.BR  logrotate (8),
used to rotate the logfile. The default corresponds to:
.sp
.nf
.in +2
backup_logrotate_conf = "
	weekly
	rotate 4"
.in
.fi
.sp
Note, that no block statements are allowed within
.BR backup_logrotate_conf ,
because its entire contents will be placed within an appropriate block
statement.
.TP
.BR backup_rsh_command = \fICOMMAND\fR
Use this command to access remote archives.  Unless set, the backup
utilities will first look for an executable file named
.BR @BINDIR@/speedssh .
If not found, they will fall back to using \fB/usr/bin/ssh\fR.  It is
the responsibility of the administrator to provide for authentication
on the remote system, e.g. by using shared-key authentication.
.TP
.BR backup_retain_interval = \fINUMBER\fR
Sets the interval, in weeks, during which old backups and snapshots
are retained.  Empty value or zero means never delete the backups.

This variable is used by
.BR backup (1),
which calls
.BR backup\-cleaner (1)
if it is set.
.SH S3 SETUP
To keep archives in a
.B s3
bucket you will need the
.BR s3backer (1)
utility.
.TP
.BR backup_s3backer_options = \fILIST\fR
Additional options for
.BR s3backer (1).

Use it, e.g., to pass the
.B \-\-vhost
option if your bucket is located outside of the US region.
.TP
.BR backup_bucket_name = \fISTRING\fR
Sets the name of the
.B s3
bucket to keep the archives in.
.TP
.BR backup_mp_s3backer = \fIDIR\fR
Defines mount point for the "raw" bucket.

Default value is
.BR /mnt/s3backer .
.TP
.BR backup_mp_s3 = \fIDIR\fR
Defines mount point for the actual s3-backed filesystem.

Default value is
.BR /mnt/s3 .
.SH TAR SETUP
Tar setup variables control additional options and arguments passed to
.BR tar (1).
.TP
.BR backup_tar_options = \fILIST\fR
Use this variable to pass additional options to tar.  Do not place tar
operation switches (such as \fB-c\fR, \fB-t\fR, etc.) here!  These
will be added automatically by appropriate scripts, depending on the
operation being performed.

By default this variable is empty (no additional options passed to tar).
.TP
.BR backup_suffix = \fISTRING\fR
This variable supplies suffix for created archive names.  The default
is
.B tar .
The dot is inserted between the file name and its suffix.

This variable is useful if you request compression and want archive
file names to reflect it.  For example:
.sp
.nf
.in +2
backup_tar_options="\-j"
backup_suffix="tar.bz2"
.in
.fi
.sp
.TP
.BR backup_archive_dir = \fIDIR\fR
Directory where archive files are located.  It's OK to specify
a remote directory here, e.g.
.sp
.nf
.in +2
backup_archive_dir="10.10.0.1:/export/backup"
.in
.fi
.sp
This variable must be defined and whatever directory it points to must
already exist.

If it is not defined and
.B backup_bucket_name
is set, indicating that the
.B S3
storage is used for backups,
.B backup_archive_dir
will be set automatically to the same value as
.BR backup_mp_s3 .
.TP
.BR backup_snapshot_dir = \fIDIR\fR
Directory for incremental snapshot files.  These files are be named after
their archive counterparts, by appending the
.B .db
suffix.
.TP
.BR backup_verbose = \fIN\fR
Set this variable to any non-empty value to request additional
verbosity.  The effect of this setting depends on backup methods being
used.  For example, the
.B fs
method adds a
.B \-v
option to each invocation of
.BR tar (1).
.SH BACKUP ITEMS
A
.B backup item
identifies information that needs to be backed up.  Syntactically,
items follow the same rules as shell variable names.  Backup items
are introduced using the following variable:
.TP
.BR backup_items = \fILIST\fR
A whitespace-separated list of backup items.
.PP
For each backup item
.I name
the configuration file must provide a set of variables describing
where to obtain this information and how to store it to the archive.
These variables follow the same naming convention:
.sp
.nf
.in +2
\fIname\fR_\fBvar\fR
.in
.fi
.sp
where \fIname\fR is the item name and \fBvar\fR is a valid shell
identifier.

The \fIname\fR_\fBtype\fR variable must always be defined.  It
identifies the backup method to be applied to that item.  The
following backup methods are implemented:
.TP
.B fs
A file system backup.
.TP
.B postgres
Backup of PostgreSQL databases.
.TP
.B mysql
Backup of MySQL databases.
.TP
.B ldap
Backup of LDAP databases.
.SH FS BACKUP TYPE
This is the basic backup type.  It creates incremental backups of a
specified file system.  For each item of this type, the following
variables must be defined:
.TP
.BR \fIitem\fB_dir = \fIPATH\fR
The absolute path to the file system being backed up.
.TP
.BR \fIitem\fB_files = \fILIST\fR
A whitespace-separated list of directories and/or files in the
.B \fIitem\fB_dir
directory.
.PP
The following variables are optional:
.TP
.BR \fIitem\fB_exclude = \fILIST\fR
A whitespace-separated list of file names (or
.BR glob (3)
patterns) to exclude from archivation.  This is translated to
a list of
.B \-\-exclude
options to
.BR tar (1).
Make sure to quote globbing patterns as you would have done in shell,
to prevent them from being expanded too early.  For example:
.sp
.nf
.in +2
system_exclude="'var/spool/mail/*'"
.in
.fi
.sp
.TP
.BR \fIitem\fB_exclude_from = \fILIST\fR
A list of files to read exclusion patterns from.  It is translated
into a list of
.B \-\-exclude\-from
options.
.TP
.BR \fIitem\fB_tar_options = \fILIST\fR
A list of additional options to pass to tar.  Use this with caution.
.PP
For example:
.sp
.nf
.in +2
backup_items="system"

system_type=fs
system_dir="/"
system_files="etc var/spool"
.in
.fi
.sp
This configuration requests incremental backups of everything found in
the directories \fB/etc\fR and \fB/var/spool\fR.
.SH POSTGRES BACKUP TYPE
The
.B postgres
type creates a dump of a PostgreSQL database and archives it using
.BR tar (1).
The following variables must be defined for items of this type:
.TP
.BR \fIitem\fB_database = \fISTRING\fR
The database name.
.SH MYSQL BACKUP TYPE
The
.B mysql
backup type creates a dump of a MySQL database and archives it with
.BR tar (1).
The database to dump and access credentials are specified using the
following variables:
.TP
.BR \fIitem\fB_alldb = single | monolithic | split | individual
Determines how to dump databases if the \fIitem\fB_database\fR
(see below) variable is not set.  The value \fBsingle\fR or
\fBmonolithic\fR means dump all databases to a single file named
after the \fIitem\fR.  This is the default. The value \fBsplit\fR
or \fBindividual\fR instructs \fBbeam\fR to dump each database into
a separate file, named
.nh
\fIitem\fB-\fIdbname\fB-\fIweek\fB-\fIround\fB-\fIlevel\fB.\fIsuffix\fR
.hy
.TP
.BR \fIitem\fB_database = \fISTRING\fR
The database name.  If this variable is empty, all databases will be
dumped.
.TP
.BR \fIitem\fB_defaults_file = \fIFILE\fR
A full pathname of the MySQL defaults file which contains credentials for
accessing this database.  This file must have at least the
.B mysqldump
and
.B mysql
sections, the former being used when dumping the database and the
latter when restoring it.
.SH LDAP BACKUP TYPE
A LDAP database is introduced with the
.B ldap
backup type.  The following keywords specify what to backup:
.TP
.BR \fIitem\fB_database_directory = \fIDIR\fR
Specifies the pathname of a directory that contains the database
files.  This is used at restore time to clean up old database contents
prior to restoring it.
.TP
.BR \fIitem\fB_database_number = \fINUMBER\fR
Number of the database to dump, if your LDAP configuration contains
several databases.  If absent, all databases will be dumped.  This
keyword cannot be used in conjunction with
.B \fIitem\fB_database_suffix
(see below).
.TP
.BR \fIitem\fB_database_suffix = \fISTRING\fR
Use the specified suffix to determine which database to operate upon.
.TP
.BR \fIitem\fB_uri = \fIURI\fR
Use dn, scope and filter from the supplied argument URI to handle
only matching entries.
.TP
.BR \fIitem\fB_user = \fINAME\fR
Restore the database with the privileges of this user.
.TP
.BR \fIitem\fB_slapcat_options = \fILIST\fR
A list of additional options for
.BR slapcat (8C).
Use with caution.
.TP
.BR \fIitem\fB_slapadd_options = \fILIST\fR
A list of additional options to pass to
.BR slapadd (8C)
when restoring from the backup.
.SH MAIL NOTIFICATION
Apart from usual logging, backup reports can be sent via email to
selected recipients.  To enable this feature, the variable
.B backup_notify_email
must be defined to a comma-separated list of recipient email
addresses.
.PP
A number of variables is provided to customize the email headers and
contents.
.TP
.BR backup_notify_email = \fILIST\fR
Sets a list of emails to receive backup report.  Multiple emails must
be separated with commas.  If not set, no notification will be sent.
.TP
.BR backup_sender_email = \fIEMAIL\fR
Defines the sender email address.  Backup reports will appear to be
sent from this address.  The default value is
\fBroot\fR@\fIhostname\fR, when \fIhostname\fR is the name of the host
on which the backup is run.

If set, this variable must contain a single email address, without
personal part or comments, e.g.
.sp
.nf
.in +2
backup_sender_email=root@example.com
.in
.fi
.sp
.TP
.BR backup_sender_personal = \fISTRING\fR
Defines personal part of the sender email.  The personal part will be
enclosed in double quotes and prepended to the value of
.B backup_sender_email
to form a valid RFC-2822
.B From
header.  For example, if you have:
.sp
.nf
.in +2
backup_sender_email=root@example.com
backup_sender_personal="Automatic backup report"
.in
.fi
.sp
then the resulting report will contain:
.sp
.nf
.in +2
From: "Automatic backup report" <root@example.com>
.in
.fi
.sp
.TP
.BR backup_report_headers = \fILIST\fR
Defines additional headers for the report message.  By default, the
following headers are generated:
.BR From ,
.BR To ,
.BR Subject ,
.BR X\-Beam\-Items ,
.BR X\-Beam\-Round ,
and
.BR X\-Beam\-Level .
The three \fBX\-\fR headers contain the backed up
items (as set in the
.B backup_items
variable), backup round and backup level numbers, correspondingly.

To supply multiple headers, delimit them with single newline characters.
.TP
.BR backup_report_intro = \fITEXT\fR
Sets the introductory text to be displayed before the actual report.
.TP
.BR backup_report_signature = \fITEXT\fR
Sets the signature text, which will be output after the report body.
.TP
.BR backup_mailer_program = \fICOMMAND\fR
Defines the mailer program and its arguments.  The default is
.sp
.nf
.in +2
/usr/sbin/sendmail \-oi \-t \-F $backup_sender_email
.in
.fi
.sp
.SH HOOKS
Special variables, called hooks, allow you to supply arbitrary
commands to be run at particular stages of the backup or restore process. 
.TP
.BR openlog_hook = \fILIST\fR
Commands listed in this variable are run before opening the logfile.  The
most common use for this hook is to rotate an oversized logfile prior to
opening it.

The default configuration file initializes this hook with
.BR beam_logrotate ,
a shell function that uses
.BR logrotate (8)
to manage the log file.  Configuration for
.BR logrotate (8)
can be supplied in the
.B backup_logrotate_conf
variable.  By default, the log file is rotated weekly and 4
weeks worth of backlogs are preserved.
.TP
.BR prologue_hook = \fILIST\fR
This variable contains a whitespace-separated list of commands to
be invoked before starting backup (or restore).  These commands are
started in order of their appearance in the list and are called
without arguments.  By default, this variable is empty.
.TP
.BR epilogue_hook = \fILIST\fR
This variable contains a whitespace-separated list of commands to
be invoked after the backup (or restore) has finished.  These commands are
started in order of their appearance in the list and are called
without arguments.  By default, this variable is empty.
.SH EXAMPLES
A simple configuration file for backing up the contents of
.BR /etc,
.BR /home ,
and the PostreSQL database
.BR savane :
.sp
.nf
.in +2
# Request bzip2 compression:
backup_tar_options="\-j"
# Modify file name suffix accordingly
backup_suffix="tar.bz2"
# Write data to \fB/dev/rmt1\fR on a remote machine:
backup_archive_dir=192.168.0.1:/dev/rmt1
# Keep snapshots in this directory:
backup_snapshot_dir=/var/snapshots

# Two backup items are defined:
backup_items="dbdump system"

# The \fBdbdump\fR item dumps the database:
dbdump_type=postgres
dbdump_database=savane

# The \fBsystem\fR item backs up the file system:
system_type=fs
system_dir="/"
system_files="etc home"

# Notify root about the results.
backup_notify_email=root@example.com
backup_sender_email=devnull@example.com
backup_sender_personal="Automatic daily backup"
backup_report_intro="Today's daily backup produced the following
results."
backup_report_signature="\-\-
Best regards,
Beam Automatic Backup"
.in
.fi
.sp 
.SH "SEE ALSO"
.BR beam (1),
.BR beam\-restore (1),
.BR beam\-backup (1),
.BR beam\-cleaner (1).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
Report bugs to <@PACKAGE_BUGREPORT@>.
.\" Local variables:
.\" eval: (add-hook 'write-file-hooks 'time-stamp)
.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.]* [0-9] \""
.\" time-stamp-format: "%:B %:d, %:y"
.\" time-stamp-end: "\""
.\" time-stamp-line-limit: 20
.\" end:

Return to:

Send suggestions and report system problems to the System administrator.