55167285cc8557e765938a5c35818c869f5396c7
[debian/amanda] / docs / internals.txt
1
2          Chapter 24. Amanda Internals
3 Prev  Part V. Technical Background  Next
4
5 -------------------------------------------------------------------------------
6
7 Chapter 24. Amanda Internals
8
9
10 George Scott
11
12 Original text<George.Scott@cc.monash.edu.au>
13
14 Stefan G. Weichinger
15
16 XML-conversion
17 AMANDA Core Team
18 <sgw@amanda.org>
19 Table of Contents
20
21
22   Protocols
23
24   server_and_amandad_on_client
25
26   planner_and_driver
27
28   driver_and_dumper
29
30   taper(read)_and_taper(write)
31
32 This is an attempt to document Amanda's internals. Please feel free to make
33 comments and suggest changes. Text for new sections gratefully accepted!
34
35  Protocols
36
37
38 Note
39
40 The following was an ASCII-illustration in the original docs, I managed to
41 transfer it at last. Maybe someone will convert this to the first image in the
42 Amanda-docs ;-) . sgw.
43
44
45         Client I Server         +-planner-+
46                I                |         |
47                I                |         |
48                I                |         |                     ______
49   +-amandad-+  I                |         |                    (______)
50   |         |  I                |         |                    |amdump|
51   |         |  I                |         |           all ::::>|      |
52   |         |  I                |         |           stderr   |      |
53   |         |  I                |         |                    |      |
54   |         |  I                |   so    |                    +------+
55   |         |  I                +---------+
56   |         |  I                    ::                          ______
57   |         |  I                    \/                         (______)
58   |         |  I                +-driver--+                    | log  |
59   +---------+  I                |   si    |           all ::::>|      |
60                I                |         |           log      |      |
61                I                |         |                    |      |
62   +-sendback+  I                |         |                    +------+
63   |         |  I                |         |
64   |         |  I        ::::::::|         |<::::::
65   |         |  I       ::       |         |      ::
66   |         |  I      ::   ::::>|         |::::   ::
67   |         |  I      ::  ::    |         |   ::  ::
68   |         |  I      :: ::     +---------+    :: ::
69   |         |  I      :: ::                    :: ::
70   |         |  I      :: ::                    :: ::
71   |         |  I      :: ::       ______       :: ::
72   +---------+  I      :: ::      (______)      :: ::
73                I      :: ::      | /tmp |      :: ::
74                I      \/ ::    :>|      |      \/ ::
75   +-dump----+  I  +-dumper--+ :: +------+    +-taper/r-+    +-taper/w-+
76   |         |  I  |   si so | ::             | si so   |    |         |
77   |         |  I  |         | ::  ______     |         |    |         |
78   |         |  I  |mesgfd   | :: (______)    |         |    |         |
79   |       se|::::>|::::::::>|::  | hold |    |         |    |         |
80   |         |  I  |     errf|    | disk |    |      p2c|:::>|p2c      |
81   |         |  I  |         |    |      |    |      c2p|<:::|c2p      |
82   ____
83   |         |  I  |datafd   | ::>|      |::: |fd       |    |         |   /   \
84   |       so|::::>|::::::::>|::  +------+  :>|::::::::>SHDMEM::::::::>|::
85   >|tape|
86   |         |  I  |    outfd| ::          :: |         |    |   tapefd|   \ _ /
87   +---------+  I  +---------+  ::::::::::::  +---------+    +---------+
88                I
89
90
91  server and amandad on client
92
93 XXX - still to be done
94
95  planner and driver
96
97 planner interrogates all clients and generates a plan of which disks to backup
98 and what dump level to do them at. The plan is plain text with one line per
99 disk to be dumped. It is piped from planners stdout to drivers stdin. Plan
100 lines come in two flavours:
101 For total dumps: <host> <disk> <pri> <lev> <size> <time> <deg lev> <deg size>
102 <deg time>
103 For incremental dumps: <host> <disk> <pri> <lev> <size> <time>
104 Where: <host> Host name of client (from disklist file) <disk> Name of disk
105 (from disklist file) <pri> Priority of backup (pri from disklist and
106 amanda.conf + days overdue for total) <lev> Dump level for dump (0 for total,
107 1-9 for incremental) <size> Estimated size (in Kb after compression if
108 requested) <time> Estimated time for backup (in seconds) <deg lev> <lev> to use
109 if in degraded mode <deg size> <size> to use if in degraded mode <deg time>
110 <time> to use if in degraded mode
111
112  driver and dumper
113
114 dumper talks via two pipes connected to each dumper's stdin and stdout. The
115 commands and responses are plain text.
116 driver can ask dumper to do a dump to a file on the holding disk: FILE-DUMP
117 <handle> <filename> <host> <disk> <level> <dumpdate> <chunksize> <prog>
118 <options> or directly to taper: PORT-DUMP <handle> <port> <host> <disk> <level>
119 <dumpdate> <prog> <options> or exit at the end of the run: QUIT
120 If the dump finishes correctly dumper replies with: DONE <handle> [<message>]
121 If something goes wrong with the dump, dumper can request that the dump be
122 retried at a later time with: TRY-AGAIN <handle> [<message>] or, for fatal
123 errors, be abandoned with: FAILED <handle> [<message>]
124 If the holding disk runs out of space, dumper will give: NO-ROOM <handle> and
125 wait for driver to either fix the problem and say: CONTINUE or just say: ABORT
126 in which case dumper kills the dump and replies with: ABORT-FINISHED <handle>
127 If driver says something that dumper doesn't recognise it responds with: BAD-
128 COMMAND <message>
129 Where: <handle> Request ID <filename> Name of file (on holding disk) to write
130 dump <port> Port (of taper) to send dump directly <host> Hostname of client
131 <disk> Disk to backup <level> Dump level to do backup at <prog> Dump program to
132 use <options> Options to pass to sendbackup <message> Error or status message
133 *driver and taper
134 driver talks via two pipes connected to taper's stdin and stdout. The commands
135 and responses are plain text.
136 driver initialises taper with: START-TAPER <datestamp> to which taper replies
137 with: TAPER-OK or, for fatal errors, with: TAPER-ERROR [<message>]
138 driver can ask taper to to copy a file from the holding disk to tape: FILE-
139 WRITE <handle> <filename> <host> <disk> <level> or directly from a dumper:
140 PORT-WRITE <handle> <host> <disk> <level> or exit at the end of the run: QUIT
141 taper responds to the PORT-WRITE command with: PORT <port> which driver should
142 then hand on to dumper in a PORT-DUMP command.
143 taper responds to the QUIT command with: QUITING
144 If the copy to tape finishes correctly taper replies with: DONE <handle>
145 [<message>]
146 If something goes wrong with the tape, taper can request that the dump be
147 retried at a later time with: TRY-AGAIN <handle> [<message>] or, for fatal
148 errors, be abandoned with: TAPE-ERROR <handle> [<message>]
149 If driver says something that taper doesn't recognise it responds with: BAD-
150 COMMAND <message>
151 Where: <datestamp> Todays date as "yymmdd" <handle> Request ID <filename> Name
152 of file (on holding disk) to write dump <port> Port (of taper) to send dump
153 directly <host> Hostname of client <disk> Disk to backup <level> Dump level to
154 do backup at <message> Error or status message
155
156  taper(read) and taper(write)
157
158 There are two parts to taper: the file reader and the tape writer.
159 Communication between the two sides is via a bit of shared memory for data
160 transfer and two pipes (one in each direction) for synchronisation.
161 The shared memory area is made up of NBUFS (=20) buffers each of which contains
162 a status word and a BUFFER_SIZE (=32*1024) byte data buffer.
163 The sync pipes are used to transfer a simplistic command sequence:
164 reader writer ------ ------
165 Startup S<datestamp> ---> <--- S Start OK <--- E<messge> Error
166 Open tape O<datestamp><hostname><diskname><level> ---> <--- O Opening
167 Write buffer W<bufnum> ---> <--- R<bufnum> Buffer empty <--- E<message> Error
168 <--- T<message> Error, try again E ack e ---> Protocol error X ---> <--- x X
169 ack
170 Close tape C ---> <--- C<label><filenum><stats> Closing
171 Quit Q --->
172
173 Note
174
175 Refer to http://www.amanda.org/docs/internals.html for the current version of
176 this document.
177 -------------------------------------------------------------------------------
178
179 Prev                            Up                           Next
180 Chapter 23. Amanda dumper API  Home  Chapter 25. Amanda Event API
181