added .sys
[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   .sys     --  general system reports
48
49 Support for additional configuration types can be added by dropping
50 bash scripts with the name of the suffix into /usr/share/backupninja. 
51
52 The configuration files are processed in alphabetical order. However,
53 it is suggested that you name the config files in "sysvinit style." 
54
55 For example:
56         00-disabled.ldap
57         10-runthisfirst.sh
58         20-runthisnext.mysql
59         90-runthislast.rdiff
60
61 Typically, you will put a '.rdiff' config file last, so that any
62 database dumps you make are included in the filesystem backup. 
63 Configurations files which begin with 0 (zero) are skipped.
64
65 Unless otherwise specified, the config file format is "ini style."
66
67 For example:
68
69    # this is a comment
70    
71    [fishes]
72    fish = red
73    fish = blue
74
75    [fruit]
76    apple = yes
77    pear = no thanks \
78    i will not have a pear.
79
80 REAL WORLD USAGE
81 ================
82
83 Backupninja can be used to impliment whatever backup strategy you
84 choose. It is intended, however, to be used like so:
85
86 (1) First, databases are safely copied or exported to /var/backups.
87     Typically, you cannot make a file backup of a database while it
88     is in use, hence the need to use special tools to make a safe copy
89     or export into /var/backups.
90      
91 (2) Then, vital parts of the file system, including /var/backups, are
92     nightly pushed to a remote, off-site, hard disk (using
93     rdiff-backup). The local user is root, but the remote user is not
94     priviledged. Hopefully, the remote filesystem is encrypted. 
95
96 There are many different backup strategies out there, including "pull
97 style", magnetic tape, rsync + hard links, etc. We believe that the
98 strategy outlined above is the way to go because: (1) hard disks are
99 very cheap these days, (2) pull style backups are no good, because then
100 the backup server must have root on the production server, and (3)
101 rdiff-backup is more space efficient and featureful than using rsync +
102 hard links. 
103
104 SSH KEYS
105 ========
106
107 In order for rdiff-backup to sync files over ssh unattended, you must
108 create ssh keys on the source server and copy the public key to the
109 remote user's authorized keys file. For example:
110
111   root@srchost# ssh-keygen -t dsa
112   root@srchost# ssh-copy-id -i /root/.ssh/id_dsa.pub backup@desthost 
113
114 Now, you should be able to ssh from user 'root' on srchost to
115 user 'backup' on desthost without specifying a password.
116
117 Note: when prompted for a password by ssh-keygen, just leave it
118 blank by hitting return.
119
120 INSTALLATION
121 ============
122    
123 Requirements:
124   apt-get install bash gawk
125
126 Recommended: 
127   apt-get install rdiff-backup gzip
128
129 Suggested:
130   apt-get install sfdisk discover  
131
132 Files:
133   /usr/sbin/backupninja        -- main script
134   /etc/cron.d/backupninja      -- runs main script nightly
135   /etc/logrotate.d/backupninja -- rotates backupninja.log
136   /etc/backup.d/               -- directory for configuration files
137   /etc/backupninja.conf        -- general options 
138   /usr/share/backupninja       -- handler scripts which do the actual work
139
140 Installation:
141   There is no install script, but you just need to move files to the
142   correct locations. All files should be owned by root.
143  
144   # tar xvzf backupninja.tar.gz
145   # cd backupninja
146   # mv backupninja /usr/sbin/backupninja
147   # mv etc/logrotate.d/backupninja /etc/logrotate.d/backupninja
148   # mv etc/cron.d/backupninja /etc/cron.d/backupninja
149   # mkdir /etc/backup.d/
150   # mv etc/backupninja.conf /etc/backupninja.conf
151   # mv handlers /usr/share/backupninja