moved all to trunk
[matthijs/upstream/backupninja.git] / README
1
2                                           |\_
3                  B A C K U P N I N J A   /()/
4                                          `\|
5                          
6       a silent flower blossom death strike to lost data.
7
8 Backupninja allows you to coordinate system backup by dropping a few
9 simple configuration files into /etc/backup.d/. Most programs you
10 might use for making backups don't have their own configuration file
11 format. Backupninja provides a centralized way to configure and
12 coordinate many different backup utilities. 
13
14 Features:
15  - easy to read ini style configuration files.
16  - secure, remote, incremental filesytem backup (via rdiff-backup).
17    incremental data is compressed. permissions are retained even
18    with an unpriviledged backup user.
19  - backup of mysql databases (via mysqlhotcopy and mysqldump).
20  - backup of ldap databases (via slapcat and ldapsearch).
21  - passwords are never sent via the command line to helper programs.
22  - you can drop in scripts to handle new types of backups.
23
24 The following options are available:
25 -h         This help message
26 -d         Run in debug mode, where all log messages are output
27            to the current shell.
28 -f <file>  Use <file> for the main configuration instead of
29            /etc/backupninja.conf
30  
31 CONFIGURATION FILES
32 ===================
33
34 The general configuration file is /etc/backupninja.conf. In this file
35 you can set the log level and change the default directory locations.
36 You can force a different general configuration file with "backupninja
37 -f /path/to/conf".
38
39 To preform the actual backup, backupninja processes each configuration
40 file in /etc/backup.d according to the file's suffix:
41  
42   .sh      --  run this file as a shell script.
43   .rdiff   --  this is a configuration for rdiff-backup
44   .maildir --  this is a configuration to backup maildirs
45   .mysql   --  mysql backup configuration
46   .ldap    --  ldap backup configuration
47
48 Support for additional configuration types can be added by dropping
49 bash scripts with the name of the suffix into /usr/share/backupninja. 
50
51 The configuration files are processed in alphabetical order. However,
52 it is suggested that you name the config files in "sysvinit style." 
53
54 For example:
55         00-disabled.ldap
56         10-runthisfirst.sh
57         20-runthisnext.mysql
58         90-runthislast.rdiff
59
60 Typically, you will put a '.rdiff' config file last, so that any
61 database dumps you make are included in the filesystem backup. 
62 Configurations files which begin with 0 (zero) are skipped.
63
64 Unless otherwise specified, the config file format is "ini style."
65
66 For example:
67
68    # this is a comment
69    
70    [fishes]
71    fish = red
72    fish = blue
73
74    [fruit]
75    apple = yes
76    pear = no thanks \
77    i will not have a pear.
78
79 REAL WORLD USAGE
80 ================
81
82 Backupninja can be used to impliment whatever backup strategy you
83 choose. It is intended, however, to be used like so:
84
85 (1) First, databases are safely copied or exported to /var/backups.
86     Typically, you cannot make a file backup of a database while it
87     is in use, hence the need to use special tools to make a safe copy
88     or export into /var/backups.
89      
90 (2) Then, vital parts of the file system, including /var/backups, are
91     nightly pushed to a remote, off-site, hard disk (using
92     rdiff-backup). The local user is root, but the remote user is not
93     priviledged. Hopefully, the remote filesystem is encrypted. 
94
95 There are many different backup strategies out there, including "pull
96 style", magnetic tape, rsync + hard links, etc. We believe that the
97 strategy outlined above is the way to go because: (1) hard disks are
98 very cheap these days, (2) pull style backups are no good, because then
99 the backup server must have root on the production server, and (3)
100 rdiff-backup is more space efficient and featureful than using rsync +
101 hard links. 
102
103 SSH KEYS
104 ========
105
106 In order for rdiff-backup to sync files over ssh unattended, you must
107 create ssh keys on the source server and copy the public key to the
108 remote user's authorized keys file. For example:
109
110   root@srchost# ssh-keygen -t dsa
111   root@srchost# ssh-copy-id -i /root/.ssh/id_dsa.pub backup@desthost 
112
113 Now, you should be able to ssh from user 'root' on srchost to
114 user 'backup' on desthost without specifying a password.
115
116 Note: when prompted for a password by ssh-keygen, just leave it
117 blank by hitting return.
118
119 INSTALLATION
120 ============
121    
122 Requirements:
123   apt-get install bash gawk
124
125 Suggested:
126   apt-get install rdiff-backup gzip
127
128 Files:
129   /usr/sbin/backupninja        -- main script
130   /etc/cron.d/backupninja      -- runs main script nightly
131   /etc/logrotate.d/backupninja -- rotates backupninja.log
132   /etc/backup.d/               -- directory for configuration files
133   /etc/backupninja.conf        -- general options 
134   /usr/share/backupninja       -- handler scripts which do the actual work
135
136 Installation:
137   There is no install script, but you just need to move files to the
138   correct locations. All files should be owned by root.
139  
140   # tar xvzf backupninja.tar.gz
141   # cd backupninja
142   # mv backupninja /usr/sbin/backupninja
143   # mv etc/logrotate.d/backupninja /etc/logrotate.d/backupninja
144   # mv etc/cron.d/backupninja /etc/cron.d/backupninja
145   # mkdir /etc/backup.d/
146   # mv etc/backupninja.conf /etc/backupninja.conf
147   # mv handlers /usr/share/backupninja