xrctl.xml(5) Crossroads control-script configuration file


The file /etc/xrctl.xml is xrctl's configuration. It defines how xrctl will start the balancer xr. If you wish to use xrctl to control the balancer, then you must configure all services, options and back ends in xrctl.xml.


The following is a configuration example. See the file xr.pdf which is distributed with the sources for a full description.

<?xml version="1.0" encoding="UTF-8">
  <!-- General system configuration section -->
    <!-- Path where the "xr" binary is searched, and zippers as "gzip"
         and "bzip2", and the "ps" command. Default is that xrctl
         uses $PATH. -->
    <!-- "ps" command that shows the PID and command. On Solaris, use
         /usr/bin/ps -ef "pid comm"  and on Linux/MacOSX use
         /bin/ps -ax -o pid,command. Default is that xrctl guesses
         the right command. Example:
         <pscmd>/bin/ps ax -o pid,command</pscmd>  -->
    <!-- Use "logger" to add output to syslog or not? Logger will be
         used if the binary can be found, and if uselogger is true. -->
    <!-- The default logger is the program "logger". Redefine here if
         you like, for example to a piping logrotate program. Example: 
         <logger>clpipe /var/log/xr.clog</logger>
         The default <logger> command is: logger -t xr.{service} -->
    <!-- If logger is NOT used, xrctl will manage log output. In that
         case, specify the following:
         - Where do logs get written?
         - How big may the logs become? Manipulated during "xrctl rotate".
         - How many history logs to keep?
         <loghistory>10</loghistory> -->
    <!-- To force log line timestamping, add:
         Or turn it off with value "false". -->
  <!-- Service descriptions: This section defines all balancing
       services that you want to start. Each service will lead to one
       invocation of "xr". -->
  <!-- Very simple TCP service that dispatches SSH connections on
       port 20.000 to three back ends. Most options are left to
       their defaults. -->
    <!-- Service name, must be unique -->
      <!-- Type (tcp/http, here: tcp), and IP-address/port to bind
           to. Use "0" for IP-address to bind to all interfaces. The
           web interface will listen to localhost, port 20.001. -->
      <!-- Clients may be idle for 30 minutes, then they are logged
           out. But they must accept data from XR within 3 seconds,
           the latter is the write timeout: -->
      <!-- DNS entries are by default cached for 3600 sec (1 hour).
           Change if you like, for example to half an hour: -->
    <!-- Back ends for the service. -->
      <!-- IP:port to dispatch to. -->
  <!-- Here is an HTTP service for web balancing. It shows more
       advanced features. -->
    <!-- Balancer server description -->
      <!-- Server binding. XR will listen to any IP interface, on port
           20.010. It'll be an HTTP balancer. The web interface will
           be on port 20.011 and bound only to the local host address. -->
      <!-- A non-default dispatch mode, here: by client IP.-->
      <!-- Checks. Dead back ends are checked each 3 seconds. There is
           no checking of dead and live back ends (checkupinterval 0). -->
        <!-- Let's go with full messaging: verbose, debug, and logging
             of transmitted messages. -->
      <!-- If the balancer runs out of sockets because too many
           closing connections are in TIME_WAIT state, use: -->
      <!-- XR can run specific scripts when client activity starts or
           ends. When given, the scripts are run with the arguments:
           the client IP, and the back end (server:port), and the
           number of connections to that back end. A very simple script
           /where/ever/activitystart might e.g. do:
             echo Client $1 going to back end $2, $3 connections so far                 >> /tmp/activity.log
           A very simple script /where/ever/activityend might e.g. do:
             echo Client $1 is done with back end $2 >> /tmp/activity.log
           - onstart: is run when a client is about to be handled at a
             back end
           - onend: is run after successful termination
           - onfail: is run after unsuccessful termination
      <!-- Access restrictions: we allow from two IP ranges, and deny
           from one IP address. The overall results:will be:
           - Access will be allowed from 10.*.*.*
           - And allowed from 192.168.1.*, but not from -->
      <!-- For a nonstandard buffer size (default is 2k), use: -->
        <!-- Here is some basic DOS protection. Connections from IP's
             are counted over timeinterval seconds (here: 2 sec). When a
             client exceeds the hard limit hardmaxconnrate (here: 200),
             then it is  denied access. When it exceeds the soft limit
             softmaxconnrate (here: 150), then each connection is
             delayed for defertime microsecs (here: 1.000.000, one
             Finally, the entire balancer will be allowed to serve up
             to 400 simultaneous connections. -->
        <!-- Let's add some more protection. When a user exceeds their
             hard maxconn rate, "/path/to/program" will be invoked
             with the IP as argument. That program may eg. call
             iptables to block the client. There is also a tag
             softmaxconnexcess (not shown here). -->
        <!-- Since this is an HTTP balancer, let's add some goodies:
             no header for the XR version,
             a header X-Forwarded-For: client-ip
             no sticky http sessions
             two serverheaders to insert -->
          <header>MyFirstHeader: Whatever</header>
          <header>MySecondHeader: WhateverElse</header>
    <!-- Back end definitions -->
      <!-- Backend lives on server1:80 and is very big (weight 2).
           XR will forward up to 300 connections to it. The back end
           checking is left to the default, which is: connect to the
           IP and port of the back end. Requests for host
           www.mysite.org will be serviced here. -->
      <!-- Backend lives on server2:80, has the default weight 1.
           XR will forward up to 100 connections to it. The back end
           checking is done by connecting to an alternative port 81.
           This back end will be eligible for requests for the site
           www.myothersite.org. -->
      <!-- Backend lives on server3:80, has the standard weight and no
           limitations for the max nr. of connections. Back end
           checking is done by retrieving /healthcheck.cgi from the
           server. The back end is eligible for www.myothersite.org. -->


xrctl and the corresponding configuration file format were written by Karel Kubat <[email protected]>. Web page: http://crossroads.e-tunity.com

This man page was written by Karel Kubat <[email protected]>.