Various minor text tweaks.
[yaz-moved-to-github.git] / doc / gfs-virtual.xml
1 <!--
2    Description of the virtual host mechanism in YAZ GFS
3    Included in both manual and man page for yaz-ztest
4 -->
5
6 <para>
7  The Virtual hosts mechanism allows a YAZ frontend server to
8  support multiple backends. A backend is selected on the basis of
9  the TCP/IP binding (port+listening adddress) and/or the virtual host.
10 </para>
11 <para>
12  A backend can be configured to execute in a particular working
13  directory. Or the YAZ frontend may perform CQL to RPN conversion, thus
14  allowing traditional Z39.50 backends to be offered as a SRW/SRU
15  service. SRW/SRU Explain information for a particular backend may also
16  be specified.
17 </para>
18 <para>
19  For the HTTP protocol, the virtual host is specified in the Host header.
20  For the Z39.50 protocol, the virtual host is specified as in the
21  Initialize Request in the OtherInfo, OID 1.2.840.10003.10.1000.81.1.
22 </para>
23 <note>
24  <para>
25   Not all Z39.50 clients allows the VHOST information to be set.
26   For those the selection of the backend must rely on the
27   TCP/IP information alone (port and address).
28  </para>
29 </note>
30 <para>
31  The YAZ frontend server uses XML to describe the backend
32  configurations. Command-line option <literal>-f</literal>
33  specifies filename of the XML configuration.
34 </para>
35 <para>
36  The configuration uses the root element <literal>yazgfs</literal>.
37  This element includes a list of <literal>listen</literal> elements,
38  followed by one or more <literal>server</literal> elements.
39 </para>
40 <para>
41  The <literal>listen</literal> describes listener (transport end point),
42  such as TCP/IP, Unix file socket or SSL server. Content for
43  a listener:
44  <variablelist>
45   <varlistentry><term>CDATA (required)</term>
46    <listitem>
47     <para>
48      The CDATA for the <literal>listen</literal> element holds the
49      listener string, such as <literal>tcp:@:210</literal>,
50      <literal>tcp:server1:2100</literal>,
51      etc.
52     </para>
53    </listitem>
54   </varlistentry>
55   <varlistentry><term>attribute <literal>id</literal> (optional)</term>
56     <listitem>
57      <para>
58       identifier for this listener. This may be referred to from
59       server sections.
60      </para>
61     </listitem>
62    </varlistentry>
63  </variablelist>
64  <note>
65   <para>
66    We expect more information to be added for the listen section in
67    a future version, such as CERT file for SSL servers.
68   </para>
69  </note>
70 </para>
71 <para>
72  The <literal>server</literal> describes a server and the parameters
73  for this server type. Content for a server:
74  <variablelist>
75   <varlistentry><term>attribute <literal>id</literal> (optional)</term>
76    <listitem>
77     <para>
78      Identifier for this server. Currently not used for anything,
79      but it might be for logging purposes.
80    </para>
81    </listitem>
82   </varlistentry>
83
84   <varlistentry><term>attribute <literal>listenref</literal> (optional)</term>
85    <listitem>
86     <para>
87      Specifies one or more listeners for this server. Each server ID is
88      separated by a comma.
89      If this attribute is not given, the server is accessible from all
90      listeners. In order for the server to be used for real, however, the
91      virtual host must match if specified in the configuration.
92     </para>
93    </listitem>
94   </varlistentry>
95
96   <varlistentry><term>element <literal>config</literal> (optional)</term>
97    <listitem>
98     <para>
99      Specifies the server configuration. This is equivalent
100      to the config specified using command line option
101      <literal>-c</literal>.
102     </para>
103    </listitem>
104   </varlistentry>
105
106   <varlistentry><term>element <literal>directory</literal> (optional)</term>
107    <listitem>
108     <para>
109      Specifies a working directory for this backend server. If
110      specifid, the YAZ fronend changes current working directory
111      to this directory whenever a backend of this type is
112      started (backend handler bend_start), stopped (backend handler hand_stop)
113      and initialized (bend_init).
114     </para>
115    </listitem>
116   </varlistentry>
117
118   <varlistentry><term>element <literal>host</literal> (optional)</term>
119    <listitem>
120     <para>
121      Specifies the virtual host for this server. If this is specified
122      a client <emphasis>must</emphasis> specify this host string in
123      order to use this backend.
124     </para>
125    </listitem>
126   </varlistentry>
127
128   <varlistentry><term>element <literal>cql2rpn</literal> (optional)</term>
129    <listitem>
130     <para>
131      Specifies a filename that includes CQL to RPN conversion for this
132      backend server. See &reference-tools-cql-map;
133      If given, the backend server will only "see" a Type-1/RPN query.
134     </para>
135    </listitem>
136   </varlistentry>
137
138   <varlistentry><term>element <literal>ccl2rpn</literal> (optional)</term>
139    <listitem>
140     <para>
141      Specifies a filename that includes CCL to RPN conversion for this
142      backend server. See &reference-tools-ccl-qualifiers;
143      If given, the backend server will only "see" a Type-1/RPN query.
144     </para>
145    </listitem>
146   </varlistentry>
147
148   <varlistentry><term>element <literal>stylesheet</literal> (optional)</term>
149    <listitem>
150     <para>
151      Specifies the stylesheet reference to be part of SRU HTTP responses
152      when the client does not specify one. If neither this is given, nor
153      the client specifies one, no stylesheet reference is part of the
154      SRU HTTP response.
155     </para>
156    </listitem>
157   </varlistentry>
158
159   <varlistentry><term>element <literal>client_query_charset</literal> (optional)</term>
160    <listitem>
161     <para>
162      If specified, a conversion from the character set given to UTF-8 is
163      performed by the generic frontend server. It is only executed for
164      Z39.50 search requests (SRU/Solr are assumed to be UTF-8 encoded already).
165     </para>
166    </listitem>
167   </varlistentry>
168
169   <varlistentry><term>element <literal>docpath</literal> (optional)</term>
170    <listitem>
171     <para>
172      Specifies a path for local file access using HTTP. All URLs with
173      a leading prefix (/ exluded) that matches the value of docpath
174      are used for file access. For example, if the server is to offer
175      access in directory <literal>xsl</literal>, the docpath would be
176      <literal>xsl</literal> and all URLs of the form
177      <literal>http://host/exl</literal> will result in a local file access.
178     </para>
179    </listitem>
180   </varlistentry>
181
182   <varlistentry><term>element <literal>explain</literal> (optional)</term>
183    <listitem>
184     <para>
185      Specifies SRW/SRU ZeeRex content for this server. Copied verbatim
186      to the client. As things are now, some of the Explain content
187      seeem redundant because host information, etc. is also stored
188      elsewhere.
189     </para>
190    </listitem>
191   </varlistentry>
192
193   <varlistentry><term>element <literal>maximumrecordsize</literal> (optional)</term>
194    <listitem>
195     <para>
196      Specifies maximum record size/message size, in bytes. This
197      value also servers as maximum size of <emphasis>incoming</emphasis>
198      packages (for Record Updates etc). It's the same value as that
199      given by the <literal>-k</literal> option.
200     </para>
201    </listitem>
202   </varlistentry>
203
204   <varlistentry><term>element <literal>retrievalinfo</literal> (optional)</term>
205    <listitem>
206     <para>
207      Enables the retrieval facility supporting conversions and
208      specifications of record formats/types.
209      See <xref linkend="tools.retrieval"/> for
210      more information.
211     </para>
212    </listitem>
213   </varlistentry>
214
215  </variablelist>
216 </para>
217
218 <para>
219  The XML below configures a server that accepts connections from
220  two ports, TCP/IP port 9900 and a local UNIX file socket.
221  We name the TCP/IP server <literal>public</literal> and the
222  other server <literal>internal</literal>.
223  </para>
224  <screen>
225   <![CDATA[
226  <yazgfs>
227   <listen id="public">tcp:@:9900</listen>
228   <listen id="internal">unix:/var/tmp/socket</listen>
229   <server id="server1">
230     <host>server1.mydomain</host>
231     <directory>/var/www/s1</directory>
232     <config>config.cfg</config>
233   </server>
234   <server id="server2" listenref="public,internal">
235     <host>server2.mydomain</host>
236     <directory>/var/www/s2</directory>
237     <config>config.cfg</config>
238     <cql2rpn>../etc/pqf.properties</cql2rpn>
239     <explain xmlns="http://explain.z3950.org/dtd/2.0/">
240       <serverInfo>
241         <host>server2.mydomain</host>
242         <port>9900</port>
243         <database>a</database>
244       </serverInfo>
245     </explain>
246   </server>
247   <server id="server3" listenref="internal">
248     <directory>/var/www/s3</directory>
249     <config>config.cfg</config>
250   </server>
251  </yazgfs>
252 ]]>
253  </screen>
254 <para>
255  There are three configured backend servers. The first two
256  servers, <literal>"server1"</literal> and <literal>"server2"</literal>,
257  can be reached by both listener addresses.
258  <literal>"server1"</literal> is reached by all (two) since no
259   <literal>listenref</literal> attribute is specified.
260  <literal>"server2"</literal> is reached by the two listeners specified.
261  In order to distinguish between the two, a virtual host has
262  been specified for each of server in the <literal>host</literal>
263  elements.
264 </para>
265 <para>
266  For <literal>"server2"</literal> elements for CQL to RPN conversion
267  is supported and explain information has been added (a short one here
268  to keep the example small).
269 </para>
270 <para>
271  The third server, <literal>"server3"</literal> can only be reached
272  via listener <literal>"internal"</literal>.
273 </para>
274
275 <!-- Keep this comment at the end of the file
276 Local variables:
277 mode: nxml
278 nxml-child-indent: 1
279 End:
280 -->