Remove Ubuntu karmic from build
[idzebra-moved-to-github.git] / doc / zebrasrv-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 address) 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 <ulink url="&url.cql;">&acro.cql;</ulink> to &acro.rpn; conversion, thus
14  allowing traditional &acro.z3950; backends to be offered as a  
15 <ulink url="&url.sru;">&acro.sru;</ulink> service. 
16  &acro.sru; Explain information for a particular backend may also be specified.
17 </para>
18 <para>
19  For the HTTP protocol, the virtual host is specified in the Host header.
20  For the &acro.z3950; 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 &acro.z3950; 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 &acro.xml; to describe the backend
32  configurations. Command-line option <literal>-f</literal> 
33  specifies filename of the &acro.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 listener for this server. If this attribute is not
88      given, the server is accessible from all listener. In order
89      for the server to be used for real, however, the virtual host
90      must match (if specified in the configuration).
91     </para>
92    </listitem>
93   </varlistentry>
94
95   <varlistentry><term>element <literal>config</literal> (optional)</term>
96    <listitem>
97     <para>
98      Specifies the server configuration. This is equivalent
99      to the config specified using command line option
100      <literal>-c</literal>.
101     </para>
102    </listitem>
103   </varlistentry>
104
105   <varlistentry><term>element <literal>directory</literal> (optional)</term>
106    <listitem>
107     <para>
108      Specifies a working directory for this backend server. If
109      specified, the &yaz; frontend changes current working directory
110      to this directory whenever a backend of this type is
111      started (backend handler bend_start), stopped (backend handler hand_stop)
112      and initialized (bend_init).
113     </para>
114    </listitem>
115   </varlistentry>
116
117   <varlistentry><term>element <literal>host</literal> (optional)</term>
118    <listitem>
119     <para>
120      Specifies the virtual host for this server. If this is specified
121      a client <emphasis>must</emphasis> specify this host string in
122      order to use this backend.
123     </para>
124    </listitem>
125   </varlistentry>
126
127   <varlistentry><term>element <literal>cql2rpn</literal> (optional)</term>
128    <listitem>
129     <para>
130      Specifies a filename that includes <ulink url="&url.cql;">&acro.cql;</ulink> to &acro.rpn; conversion for this
131      backend server. See <ulink url="&url.cql;">&acro.cql;</ulink> section in &yaz; manual.
132      If given, the backend server will only "see" a Type-1/&acro.rpn; query. 
133     </para>
134    </listitem>
135   </varlistentry>
136    
137   <varlistentry><term>element <literal>explain</literal> (optional)</term>
138    <listitem>
139     <para>
140      Specifies <ulink url="&url.sru;">&acro.sru;</ulink> ZeeRex content for this
141      server - copied verbatim to the client.
142      As things are now, some of the Explain content seems redundant
143      because host information, etc. is also stored elsewhere.
144     </para>
145     <para>
146      The format of the Explain record is described in detail, with
147      examples, on the file at the
148      <ulink url="&url.zeerex.explain;">ZeeRex</ulink> web-site.
149     </para>
150    </listitem>
151   </varlistentry>
152  </variablelist>
153 </para>
154  
155 <para>
156  The &acro.xml; below configures a server that accepts connections from
157  two ports, TCP/IP port 9900 and a local UNIX file socket.
158  We name the TCP/IP server <literal>public</literal> and the
159  other server <literal>internal</literal>.
160  </para>
161  <screen>
162   <![CDATA[
163  <yazgfs>
164   <listen id="public">tcp:@:9900</listen>
165   <listen id="internal">unix:/var/tmp/socket</listen>
166   <server id="server1">
167     <host>server1.mydomain</host>
168     <directory>/var/www/s1</directory>
169     <config>config.cfg</config>
170   </server>
171   <server id="server2">
172     <host>server2.mydomain</host>
173     <directory>/var/www/s2</directory>
174     <config>config.cfg</config>
175     <cql2rpn>../etc/pqf.properties</cql2rpn>
176     <explain xmlns="http://explain.z3950.org/dtd/2.0/">
177       <serverInfo>
178         <host>server2.mydomain</host>
179         <port>9900</port>
180         <database>a</database>
181       </serverInfo>
182     </explain>
183   </server>
184   <server id="server3" listenref="internal">
185     <directory>/var/www/s3</directory>
186     <config>config.cfg</config>
187   </server>
188  </yazgfs>
189 ]]>
190  </screen>
191 <para>
192  There are three configured backend servers. The first two
193  servers, <literal>"server1"</literal> and <literal>"server2"</literal>,
194  can be reached by both listener addresses - since
195  no <literal>listenref</literal> attribute is specified.
196  In order to distinguish between the two a virtual host has
197  been specified for each of server in the <literal>host</literal>
198  elements.
199 </para>
200 <para>
201  For <literal>"server2"</literal> elements for 
202 <ulink url="&url.cql;">&acro.cql;</ulink> to &acro.rpn; conversion
203  is supported and explain information has been added (a short one here
204  to keep the example small).
205 </para>
206 <para>
207  The third server, <literal>"server3"</literal> can only be reached
208  via listener <literal>"internal"</literal>.
209 </para>
210
211 <!-- Keep this comment at the end of the file
212 Local variables:
213 mode: sgml
214 sgml-omittag:t
215 sgml-shorttag:t
216 sgml-minimize-attributes:nil
217 sgml-always-quote-attributes:t
218 sgml-indent-step:1
219 sgml-indent-data:t
220 sgml-parent-document: "zebrasrv.xml"
221 sgml-local-catalogs: nil
222 sgml-namecase-general:t
223 End:
224 -->