Update zthes example 2 to use xelm
[idzebra-moved-to-github.git] / doc / administration.xml
1 <chapter id="administration">
2  <!-- $Id: administration.xml,v 1.16 2002-12-30 12:56:07 adam Exp $ -->
3  <title>Administrating Zebra</title>
4  <!-- ### It's a bit daft that this chapter (which describes half of
5           the configuration-file formats) is separated from
6           "recordmodel.xml" (which describes the other half) by the
7           instructions on running zebraidx and zebrasrv.  Some careful
8           re-ordering is required here.
9  -->
10
11  <para>
12   Unlike many simpler retrieval systems, Zebra supports safe, incremental
13   updates to an existing index.
14  </para>
15  
16  <para>
17   Normally, when Zebra modifies the index it reads a number of records
18   that you specify.
19   Depending on your specifications and on the contents of each record
20   one the following events take place for each record:
21   <variablelist>
22    
23    <varlistentry>
24     <term>Insert</term>
25     <listitem>
26      <para>
27       The record is indexed as if it never occurred before.
28       Either the Zebra system doesn't know how to identify the record or
29       Zebra can identify the record but didn't find it to be already indexed.
30      </para>
31     </listitem>
32    </varlistentry>
33    <varlistentry>
34     <term>Modify</term>
35     <listitem>
36      <para>
37       The record has already been indexed.
38       In this case either the contents of the record or the location
39       (file) of the record indicates that it has been indexed before.
40      </para>
41     </listitem>
42    </varlistentry>
43    <varlistentry>
44     <term>Delete</term>
45     <listitem>
46      <para>
47       The record is deleted from the index. As in the
48       update-case it must be able to identify the record.
49      </para>
50     </listitem>
51    </varlistentry>
52   </variablelist>
53  </para>
54  
55  <para>
56   Please note that in both the modify- and delete- case the Zebra
57   indexer must be able to generate a unique key that identifies the record 
58   in question (more on this below).
59  </para>
60  
61  <para>
62   To administrate the Zebra retrieval system, you run the
63   <literal>zebraidx</literal> program.
64   This program supports a number of options which are preceded by a dash,
65   and a few commands (not preceded by dash).
66 </para>
67  
68  <para>
69   Both the Zebra administrative tool and the Z39.50 server share a
70   set of index files and a global configuration file.
71   The name of the configuration file defaults to
72   <literal>zebra.cfg</literal>.
73   The configuration file includes specifications on how to index
74   various kinds of records and where the other configuration files
75   are located. <literal>zebrasrv</literal> and <literal>zebraidx</literal>
76   <emphasis>must</emphasis> be run in the directory where the
77   configuration file lives unless you indicate the location of the 
78   configuration file by option <literal>-c</literal>.
79  </para>
80  
81  <sect1 id="record-types">
82   <title>Record Types</title>
83   
84   <para>
85    Indexing is a per-record process, in which either insert/modify/delete
86    will occur. Before a record is indexed search keys are extracted from
87    whatever might be the layout the original record (sgml,html,text, etc..).
88    The Zebra system currently supports two fundamental types of records:
89    structured and simple text.
90    To specify a particular extraction process, use either the
91    command line option <literal>-t</literal> or specify a
92    <literal>recordType</literal> setting in the configuration file.
93   </para>
94   
95  </sect1>
96  
97  <sect1 id="configuration-file">
98   <title>The Zebra Configuration File</title>
99   
100   <para>
101    The Zebra configuration file, read by <literal>zebraidx</literal> and
102    <literal>zebrasrv</literal> defaults to <literal>zebra.cfg</literal>
103    unless specified by <literal>-c</literal> option.
104   </para>
105   
106   <para>
107    You can edit the configuration file with a normal text editor.
108    parameter names and values are separated by colons in the file. Lines
109    starting with a hash sign (<literal>#</literal>) are
110    treated as comments.
111   </para>
112   
113   <para>
114    If you manage different sets of records that share common
115    characteristics, you can organize the configuration settings for each
116    type into "groups".
117    When <literal>zebraidx</literal> is run and you wish to address a
118    given group you specify the group name with the <literal>-g</literal>
119    option.
120    In this case settings that have the group name as their prefix 
121    will be used by <literal>zebraidx</literal>.
122    If no <literal>-g</literal> option is specified, the settings
123    without prefix are used.
124   </para>
125   
126   <para>
127    In the configuration file, the group name is placed before the option
128    name itself, separated by a dot (.). For instance, to set the record type
129    for group <literal>public</literal> to <literal>grs.sgml</literal>
130    (the SGML-like format for structured records) you would write:
131   </para>
132   
133   <para>
134    <screen>
135     public.recordType: grs.sgml
136    </screen>   
137   </para>
138   
139   <para>
140    To set the default value of the record type to <literal>text</literal>
141    write:
142   </para>
143   
144   <para>
145    <screen>
146     recordType: text
147    </screen>
148   </para>
149   
150   <para>
151    The available configuration settings are summarized below. They will be
152    explained further in the following sections.
153   </para>
154   
155   <!--
156    FIXME - Didn't Adam make something to have multiple databases in multiple dirs...
157   -->
158   
159   <para>
160    <variablelist>
161     
162     <varlistentry>
163      <term>
164       <emphasis>group</emphasis>
165       .recordType[<emphasis>.name</emphasis>]:
166       <replaceable>type</replaceable>
167      </term>
168      <listitem>
169       <para>
170        Specifies how records with the file extension
171        <emphasis>name</emphasis> should be handled by the indexer.
172        This option may also be specified as a command line option
173        (<literal>-t</literal>). Note that if you do not specify a
174        <emphasis>name</emphasis>, the setting applies to all files.
175        In general, the record type specifier consists of the elements (each
176        element separated by dot), <emphasis>fundamental-type</emphasis>,
177        <emphasis>file-read-type</emphasis> and arguments. Currently, two
178        fundamental types exist, <literal>text</literal> and
179        <literal>grs</literal>.
180       </para>
181      </listitem>
182     </varlistentry>
183     <varlistentry>
184      <term><emphasis>group</emphasis>.recordId: 
185      <replaceable>record-id-spec</replaceable></term>
186      <listitem>
187       <para>
188        Specifies how the records are to be identified when updated. See
189        <xref linkend="locating-records"/>.
190       </para>
191      </listitem>
192     </varlistentry>
193     <varlistentry>
194      <term><emphasis>group</emphasis>.database:
195      <replaceable>database</replaceable></term>
196      <listitem>
197       <para>
198        Specifies the Z39.50 database name.
199        <!-- FIXME - now we can have multiple databases in one server. -H -->
200       </para>
201      </listitem>
202     </varlistentry>
203     <varlistentry>
204      <term><emphasis>group</emphasis>.storeKeys:
205      <replaceable>boolean</replaceable></term>
206      <listitem>
207       <para>
208        Specifies whether key information should be saved for a given
209        group of records. If you plan to update/delete this type of
210        records later this should be specified as 1; otherwise it
211        should be 0 (default), to save register space.
212        <!-- ### this is the first mention of "register" -->
213        See <xref linkend="file-ids"/>.
214       </para>
215      </listitem>
216     </varlistentry>
217     <varlistentry>
218      <term><emphasis>group</emphasis>.storeData:
219       <replaceable>boolean</replaceable></term>
220      <listitem>
221       <para>
222        Specifies whether the records should be stored internally
223        in the Zebra system files.
224        If you want to maintain the raw records yourself,
225        this option should be false (0).
226        If you want Zebra to take care of the records for you, it
227        should be true(1).
228       </para>
229      </listitem>
230     </varlistentry>
231     <varlistentry>
232      <!-- ### probably a better place to define "register" -->
233      <term>register: <replaceable>register-location</replaceable></term>
234      <listitem>
235       <para>
236        Specifies the location of the various register files that Zebra uses
237        to represent your databases.
238        See <xref linkend="register-location"/>.
239       </para>
240      </listitem>
241     </varlistentry>
242     <varlistentry>
243      <term>shadow: <replaceable>register-location</replaceable></term>
244      <listitem>
245       <para>
246        Enables the <emphasis>safe update</emphasis> facility of Zebra, and
247        tells the system where to place the required, temporary files.
248        See <xref linkend="shadow-registers"/>.
249       </para>
250      </listitem>
251     </varlistentry>
252     <varlistentry>
253      <term>lockDir: <replaceable>directory</replaceable></term>
254      <listitem>
255       <para>
256        Directory in which various lock files are stored.
257       </para>
258      </listitem>
259     </varlistentry>
260     <varlistentry>
261      <term>keyTmpDir: <replaceable>directory</replaceable></term>
262      <listitem>
263       <para>
264        Directory in which temporary files used during zebraidx's update
265        phase are stored. 
266       </para>
267      </listitem>
268     </varlistentry>
269     <varlistentry>
270      <term>setTmpDir: <replaceable>directory</replaceable></term>
271      <listitem>
272       <para>
273        Specifies the directory that the server uses for temporary result sets.
274        If not specified <literal>/tmp</literal> will be used.
275       </para>
276      </listitem>
277     </varlistentry>
278     <varlistentry>
279      <term>profilePath: <replaceable>path</replaceable></term>
280      <listitem>
281       <para>
282        Specifies a path of profile specification files. 
283        The path is composed of one or more directories separated by
284        colon. Similar to PATH for UNIX systems.
285       </para>
286      </listitem>
287     </varlistentry>
288     <varlistentry>
289      <term>attset: <replaceable>filename</replaceable></term>
290      <listitem>
291       <para>
292        Specifies the filename(s) of attribute set files for use in
293        searching. At least the Bib-1 set should be loaded
294        (<literal>bib1.att</literal>).
295        The <literal>profilePath</literal> setting is used to look for
296        the specified files.
297        See <xref linkend="attset-files"/>
298       </para>
299      </listitem>
300     </varlistentry>
301     <varlistentry>
302      <term>memMax: <replaceable>size</replaceable></term>
303      <listitem>
304       <para>
305        Specifies <replaceable>size</replaceable> of internal memory
306        to use for the zebraidx program.
307        The amount is given in megabytes - default is 4 (4 MB).
308       </para>
309      </listitem>
310     </varlistentry>
311
312     <varlistentry>
313      <term>root: <replaceable>dir</replaceable></term>
314      <listitem>
315       <para>
316        Specifies a directory base for Zebra. All relative paths
317        given (in profilePath, register, shadow) are based on this
318        directory. This setting is useful if your Zebra server
319        is running in a different directory from where
320        <literal>zebra.cfg</literal> is located.
321       </para>
322      </listitem>
323     </varlistentry>
324
325      <!--
326      no longer supported.
327     <varlistentry>
328      <term>tagsysno: 0|1</term>
329      <listitem>
330       <para>
331        Species whether Zebra should include system-number data in XML
332        and GRS-1 records returned to clients, represented by the
333        <literal>&lt;localControlNumber&gt;</literal> element in XML
334        and the <literal>(1,14)</literal> tag in GRS-1.
335        The content of these elements is an internally-generated
336        integer uniquely identifying the record within its database.
337        It is included by default but may be turned off, with
338        <literal>tagsysno: 0</literal> for databases in which a local
339        control number is explicitly specified in the input records
340        themselves.
341       </para>
342      </listitem>
343     </varlistentry>
344      -->
345      
346    </variablelist>
347   </para>
348   
349  </sect1>
350  
351  <sect1 id="locating-records">
352   <title>Locating Records</title>
353   
354   <para>
355    The default behavior of the Zebra system is to reference the
356    records from their original location, i.e. where they were found when you
357    ran <literal>zebraidx</literal>.
358    That is, when a client wishes to retrieve a record
359    following a search operation, the files are accessed from the place
360    where you originally put them - if you remove the files (without
361    running <literal>zebraidx</literal> again, the server will return
362    diagnostic number 14 (``System error in presenting records'') to
363    the client.
364   </para>
365   
366   <para>
367    If your input files are not permanent - for example if you retrieve
368    your records from an outside source, or if they were temporarily
369    mounted on a CD-ROM drive,
370    you may want Zebra to make an internal copy of them. To do this,
371    you specify 1 (true) in the <literal>storeData</literal> setting. When
372    the Z39.50 server retrieves the records they will be read from the
373    internal file structures of the system.
374   </para>
375   
376  </sect1>
377  
378  <sect1 id="simple-indexing">
379   <title>Indexing with no Record IDs (Simple Indexing)</title>
380   
381   <para>
382    If you have a set of records that are not expected to change over time
383    you may can build your database without record IDs.
384    This indexing method uses less space than the other methods and
385    is simple to use. 
386   </para>
387   
388   <para>
389    To use this method, you simply omit the <literal>recordId</literal> entry
390    for the group of files that you index. To add a set of records you use
391    <literal>zebraidx</literal> with the <literal>update</literal> command. The
392    <literal>update</literal> command will always add all of the records that it
393    encounters to the index - whether they have already been indexed or
394    not. If the set of indexed files change, you should delete all of the
395    index files, and build a new index from scratch.
396   </para>
397   
398   <para>
399    Consider a system in which you have a group of text files called
400    <literal>simple</literal>.
401    That group of records should belong to a Z39.50 database called
402    <literal>textbase</literal>.
403    The following <literal>zebra.cfg</literal> file will suffice:
404   </para>
405   <para>
406    
407    <screen>
408     profilePath: /usr/local/idzebra/tab
409     attset: bib1.att
410     simple.recordType: text
411     simple.database: textbase
412    </screen>
413
414   </para>
415   
416   <para>
417    Since the existing records in an index can not be addressed by their
418    IDs, it is impossible to delete or modify records when using this method.
419   </para>
420   
421  </sect1>
422  
423  <sect1 id="file-ids">
424   <title>Indexing with File Record IDs</title>
425   
426   <para>
427    If you have a set of files that regularly change over time: Old files
428    are deleted, new ones are added, or existing files are modified, you
429    can benefit from using the <emphasis>file ID</emphasis>
430    indexing methodology.
431    Examples of this type of database might include an index of WWW
432    resources, or a USENET news spool area.
433    Briefly speaking, the file key methodology uses the directory paths
434    of the individual records as a unique identifier for each record.
435    To perform indexing of a directory with file keys, again, you specify
436    the top-level directory after the <literal>update</literal> command.
437    The command will recursively traverse the directories and compare
438    each one with whatever have been indexed before in that same directory.
439    If a file is new (not in the previous version of the directory) it
440    is inserted into the registers; if a file was already indexed and
441    it has been modified since the last update, the index is also
442    modified; if a file has been removed since the last
443    visit, it is deleted from the index.
444   </para>
445   
446   <para>
447    The resulting system is easy to administrate. To delete a record you
448    simply have to delete the corresponding file (say, with the
449    <literal>rm</literal> command). And to add records you create new
450    files (or directories with files). For your changes to take effect
451    in the register you must run <literal>zebraidx update</literal> with
452    the same directory root again. This mode of operation requires more
453    disk space than simpler indexing methods, but it makes it easier for
454    you to keep the index in sync with a frequently changing set of data.
455    If you combine this system with the <emphasis>safe update</emphasis>
456    facility (see below), you never have to take your server off-line for
457    maintenance or register updating purposes.
458   </para>
459   
460   <para>
461    To enable indexing with pathname IDs, you must specify
462    <literal>file</literal> as the value of <literal>recordId</literal>
463    in the configuration file. In addition, you should set
464    <literal>storeKeys</literal> to <literal>1</literal>, since the Zebra
465    indexer must save additional information about the contents of each record
466    in order to modify the indexes correctly at a later time.
467   </para>
468   
469    <!--
470     FIXME - There must be a simpler way to do this with Adams string tags -H
471      -->
472
473   <para>
474    For example, to update records of group <literal>esdd</literal>
475    located below
476    <literal>/data1/records/</literal> you should type:
477    <screen>
478     $ zebraidx -g esdd update /data1/records
479    </screen>
480   </para>
481   
482   <para>
483    The corresponding configuration file includes:
484    <screen>
485     esdd.recordId: file
486     esdd.recordType: grs.sgml
487     esdd.storeKeys: 1
488    </screen>
489   </para>
490   
491   <note>
492    <para>You cannot start out with a group of records with simple
493     indexing (no record IDs as in the previous section) and then later
494     enable file record Ids. Zebra must know from the first time that you
495     index the group that
496     the files should be indexed with file record IDs.
497    </para>
498    </note>
499   
500   <para>
501    You cannot explicitly delete records when using this method (using the
502    <literal>delete</literal> command to <literal>zebraidx</literal>. Instead
503    you have to delete the files from the file system (or move them to a
504    different location)
505    and then run <literal>zebraidx</literal> with the
506    <literal>update</literal> command.
507   </para>
508   <!-- ### what happens if a file contains multiple records? -->
509 </sect1>
510  
511  <sect1 id="generic-ids">
512   <title>Indexing with General Record IDs</title>
513   
514   <para>
515    When using this method you construct an (almost) arbitrary, internal
516    record key based on the contents of the record itself and other system
517    information. If you have a group of records that explicitly associates
518    an ID with each record, this method is convenient. For example, the
519    record format may contain a title or a ID-number - unique within the group.
520    In either case you specify the Z39.50 attribute set and use-attribute
521    location in which this information is stored, and the system looks at
522    that field to determine the identity of the record.
523   </para>
524   
525   <para>
526    As before, the record ID is defined by the <literal>recordId</literal>
527    setting in the configuration file. The value of the record ID specification
528    consists of one or more tokens separated by whitespace. The resulting
529    ID is represented in the index by concatenating the tokens and
530    separating them by ASCII value (1).
531   </para>
532   
533   <para>
534    There are three kinds of tokens:
535    <variablelist>
536     
537     <varlistentry>
538      <term>Internal record info</term>
539      <listitem>
540       <para>
541        The token refers to a key that is
542        extracted from the record. The syntax of this token is
543        <literal>(</literal> <emphasis>set</emphasis> <literal>,</literal>
544        <emphasis>use</emphasis> <literal>)</literal>,
545        where <emphasis>set</emphasis> is the
546        attribute set name <emphasis>use</emphasis> is the
547        name or value of the attribute.
548       </para>
549      </listitem>
550     </varlistentry>
551     <varlistentry>
552      <term>System variable</term>
553      <listitem>
554       <para>
555        The system variables are preceded by
556        
557        <screen>
558         $
559        </screen>
560        and immediately followed by the system variable name, which
561        may one of
562        <variablelist>
563         
564         <varlistentry>
565          <term>group</term>
566          <listitem>
567           <para>
568            Group name.
569           </para>
570          </listitem>
571         </varlistentry>
572         <varlistentry>
573          <term>database</term>
574          <listitem>
575           <para>
576            Current database specified.
577           </para>
578          </listitem>
579         </varlistentry>
580         <varlistentry>
581          <term>type</term>
582          <listitem>
583           <para>
584            Record type.
585           </para>
586          </listitem>
587         </varlistentry>
588        </variablelist>
589       </para>
590      </listitem>
591     </varlistentry>
592     <varlistentry>
593      <term>Constant string</term>
594      <listitem>
595       <para>
596        A string used as part of the ID &mdash; surrounded
597        by single- or double quotes.
598       </para>
599      </listitem>
600     </varlistentry>
601    </variablelist>
602   </para>
603   
604   <para>
605    For instance, the sample GILS records that come with the Zebra
606    distribution contain a unique ID in the data tagged Control-Identifier.
607    The data is mapped to the Bib-1 use attribute Identifier-standard
608    (code 1007). To use this field as a record id, specify
609    <literal>(bib1,Identifier-standard)</literal> as the value of the
610    <literal>recordId</literal> in the configuration file.
611    If you have other record types that uses the same field for a
612    different purpose, you might add the record type
613    (or group or database name) to the record id of the gils
614    records as well, to prevent matches with other types of records.
615    In this case the recordId might be set like this:
616    
617    <screen>
618     gils.recordId: $type (bib1,Identifier-standard)
619    </screen>
620    
621   </para>
622   
623   <para>
624    (see <xref linkend="data-model"/>
625     for details of how the mapping between elements of your records and
626     searchable attributes is established).
627   </para>
628   
629   <para>
630    As for the file record ID case described in the previous section,
631    updating your system is simply a matter of running
632    <literal>zebraidx</literal>
633    with the <literal>update</literal> command. However, the update with general
634    keys is considerably slower than with file record IDs, since all files
635    visited must be (re)read to discover their IDs. 
636   </para>
637   
638   <para>
639    As you might expect, when using the general record IDs
640    method, you can only add or modify existing records with the
641    <literal>update</literal> command.
642    If you wish to delete records, you must use the,
643    <literal>delete</literal> command, with a directory as a parameter.
644    This will remove all records that match the files below that root
645    directory.
646   </para>
647   
648  </sect1>
649  
650  <sect1 id="register-location">
651   <title>Register Location</title>
652   
653   <para>
654    Normally, the index files that form dictionaries, inverted
655    files, record info, etc., are stored in the directory where you run
656    <literal>zebraidx</literal>. If you wish to store these, possibly large,
657    files somewhere else, you must add the <literal>register</literal>
658    entry to the <literal>zebra.cfg</literal> file.
659    Furthermore, the Zebra system allows its file
660    structures to span multiple file systems, which is useful for
661    managing very large databases. 
662   </para>
663   
664   <para>
665    The value of the <literal>register</literal> setting is a sequence
666    of tokens. Each token takes the form:
667    
668    <screen>
669     <emphasis>dir</emphasis><literal>:</literal><emphasis>size</emphasis>. 
670    </screen>
671    
672    The <emphasis>dir</emphasis> specifies a directory in which index files
673    will be stored and the <emphasis>size</emphasis> specifies the maximum
674    size of all files in that directory. The Zebra indexer system fills
675    each directory in the order specified and use the next specified
676    directories as needed.
677    The <emphasis>size</emphasis> is an integer followed by a qualifier
678    code, 
679    <literal>b</literal> for bytes,
680    <literal>k</literal> for kilobytes.
681    <literal>M</literal> for megabytes,
682    <literal>G</literal> for gigabytes.
683   </para>
684   
685   <para>
686    For instance, if you have allocated two disks for your register, and
687    the first disk is mounted
688    on <literal>/d1</literal> and has 2GB of free space and the
689    second, mounted on <literal>/d2</literal> has 3.6 GB, you could
690    put this entry in your configuration file:
691    
692    <screen>
693     register: /d1:2G /d2:3600M
694    </screen>
695    
696   </para>
697   
698   <para>
699    Note that Zebra does not verify that the amount of space specified is
700    actually available on the directory (file system) specified - it is
701    your responsibility to ensure that enough space is available, and that
702    other applications do not attempt to use the free space. In a large
703    production system, it is recommended that you allocate one or more
704    file system exclusively to the Zebra register files.
705   </para>
706   
707  </sect1>
708  
709  <sect1 id="shadow-registers">
710   <title>Safe Updating - Using Shadow Registers</title>
711   
712   <sect2>
713    <title>Description</title>
714    
715    <para>
716     The Zebra server supports <emphasis>updating</emphasis> of the index
717     structures. That is, you can add, modify, or remove records from
718     databases managed by Zebra without rebuilding the entire index.
719     Since this process involves modifying structured files with various
720     references between blocks of data in the files, the update process
721     is inherently sensitive to system crashes, or to process interruptions:
722     Anything but a successfully completed update process will leave the
723     register files in an unknown state, and you will essentially have no
724     recourse but to re-index everything, or to restore the register files
725     from a backup medium.
726     Further, while the update process is active, users cannot be
727     allowed to access the system, as the contents of the register files
728     may change unpredictably.
729    </para>
730    
731    <para>
732     You can solve these problems by enabling the shadow register system in
733     Zebra.
734     During the updating procedure, <literal>zebraidx</literal> will temporarily
735     write changes to the involved files in a set of "shadow
736     files", without modifying the files that are accessed by the
737     active server processes. If the update procedure is interrupted by a
738     system crash or a signal, you simply repeat the procedure - the
739     register files have not been changed or damaged, and the partially
740     written shadow files are automatically deleted before the new updating
741     procedure commences.
742    </para>
743    
744    <para>
745     At the end of the updating procedure (or in a separate operation, if
746     you so desire), the system enters a "commit mode". First,
747     any active server processes are forced to access those blocks that
748     have been changed from the shadow files rather than from the main
749     register files; the unmodified blocks are still accessed at their
750     normal location (the shadow files are not a complete copy of the
751     register files - they only contain those parts that have actually been
752     modified). If the commit process is interrupted at any point during the
753     commit process, the server processes will continue to access the
754     shadow files until you can repeat the commit procedure and complete
755     the writing of data to the main register files. You can perform
756     multiple update operations to the registers before you commit the
757     changes to the system files, or you can execute the commit operation
758     at the end of each update operation. When the commit phase has
759     completed successfully, any running server processes are instructed to
760     switch their operations to the new, operational register, and the
761     temporary shadow files are deleted.
762    </para>
763    
764   </sect2>
765   
766   <sect2>
767    <title>How to Use Shadow Register Files</title>
768    
769    <para>
770     The first step is to allocate space on your system for the shadow
771     files.
772     You do this by adding a <literal>shadow</literal> entry to the
773     <literal>zebra.cfg</literal> file.
774     The syntax of the <literal>shadow</literal> entry is exactly the
775     same as for the <literal>register</literal> entry
776     (see <xref linkend="register-location"/>).
777      The location of the shadow area should be
778      <emphasis>different</emphasis> from the location of the main register
779      area (if you have specified one - remember that if you provide no
780      <literal>register</literal> setting, the default register area is the
781      working directory of the server and indexing processes).
782    </para>
783    
784    <para>
785     The following excerpt from a <literal>zebra.cfg</literal> file shows
786     one example of a setup that configures both the main register
787     location and the shadow file area.
788     Note that two directories or partitions have been set aside
789     for the shadow file area. You can specify any number of directories
790     for each of the file areas, but remember that there should be no
791     overlaps between the directories used for the main registers and the
792     shadow files, respectively.
793    </para>
794    <para>
795     
796     <screen>
797      register: /d1:500M
798      
799      shadow: /scratch1:100M /scratch2:200M
800     </screen>
801     
802    </para>
803    
804    <para>
805     When shadow files are enabled, an extra command is available at the
806     <literal>zebraidx</literal> command line.
807     In order to make changes to the system take effect for the
808     users, you'll have to submit a "commit" command after a
809     (sequence of) update operation(s).
810    </para>
811    
812    <para>
813     
814     <screen>
815      $ zebraidx update /d1/records 
816      $ zebraidx commit
817     </screen>
818     
819    </para>
820    
821    <para>
822     Or you can execute multiple updates before committing the changes:
823    </para>
824    
825    <para>
826     
827     <screen>
828      $ zebraidx -g books update /d1/records  /d2/more-records
829      $ zebraidx -g fun update /d3/fun-records
830      $ zebraidx commit
831     </screen>
832     
833    </para>
834    
835    <para>
836     If one of the update operations above had been interrupted, the commit
837     operation on the last line would fail: <literal>zebraidx</literal>
838     will not let you commit changes that would destroy the running register.
839     You'll have to rerun all of the update operations since your last
840     commit operation, before you can commit the new changes.
841    </para>
842    
843    <para>
844     Similarly, if the commit operation fails, <literal>zebraidx</literal>
845     will not let you start a new update operation before you have
846     successfully repeated the commit operation.
847     The server processes will keep accessing the shadow files rather
848     than the (possibly damaged) blocks of the main register files
849     until the commit operation has successfully completed.
850    </para>
851    
852    <para>
853     You should be aware that update operations may take slightly longer
854     when the shadow register system is enabled, since more file access
855     operations are involved. Further, while the disk space required for
856     the shadow register data is modest for a small update operation, you
857     may prefer to disable the system if you are adding a very large number
858     of records to an already very large database (we use the terms
859     <emphasis>large</emphasis> and <emphasis>modest</emphasis>
860     very loosely here, since every application will have a
861     different perception of size).
862     To update the system without the use of the the shadow files,
863     simply run <literal>zebraidx</literal> with the <literal>-n</literal>
864     option (note that you do not have to execute the
865     <emphasis>commit</emphasis> command of <literal>zebraidx</literal>
866     when you temporarily disable the use of the shadow registers in
867     this fashion.
868     Note also that, just as when the shadow registers are not enabled,
869     server processes will be barred from accessing the main register
870     while the update procedure takes place.
871    </para>
872    
873   </sect2>
874   
875  </sect1>
876  
877 </chapter>
878  <!-- Keep this comment at the end of the file
879  Local variables:
880  mode: sgml
881  sgml-omittag:t
882  sgml-shorttag:t
883  sgml-minimize-attributes:nil
884  sgml-always-quote-attributes:t
885  sgml-indent-step:1
886  sgml-indent-data:t
887  sgml-parent-document: "zebra.xml"
888  sgml-local-catalogs: nil
889  sgml-namecase-general:t
890  End:
891  -->