
This is XR, a load balancer and failover utility for TCP/HTTP services.
Usage: xr [flags], where the flags may be the following (long versions
may not exist on your platform):

  --add-server-header HDR, -H HDR
       Inserts HDR into back end bound HTTP messages. The header value is
       appended when a pre-existing header is present.
  --add-x-forwarded-for, -x
       Adds X-Forwarded-For with external IP address to back end streams in
       HTTP messages.
  --add-xr-version, -X
       Adds an XR version header to client and back end streams in HTTP
       messages.
  --allow-from MASK, -a MASH
       Allow only clients that match MASK. MASK is e.g. 192.168.255.255, which
       would allow the class B network 192.168.*.*
  --backend ADDRESS:PORT[:MAX[:WEIGHT]], -b ADDRESS:PORT[:MAX[:WEIGHT]]
       Specifies a back end, use multiple -b... to specify several back ends.
       At least one backend must be given. Specifier MAX is optional:
       when given, defines the maximum connections for the back end.
       WEIGHT is optional: when given, specifies the weight (bigger
       means better server, default 1)
  --backend-check METHOD, -g METHOD
       Defines how back ends are checked. This flag must be specified
       PRIOR to defining back ends with -b... The checker will then
       apply to all next back ends. Alternatives are:
       connect:IP:PORT - successful TCP connects at IP:PORT indicate
         that the back end is alive. When IP is not stated, the back
	 end's IP is assumed.
       get:IP:PORT/URI - A HTTP GET is sent to IP:PORT/URI. When an
         HTTP status 200 is seen, the back end is assumed alive. When
         /URI is not given, then "/" is assumed.
       external:PROGRAM - The PROGRAM is called with the arguments
         "IP:PORT", availability as "available" or "unavailable", and
         the number of connections. The program must echo 0 to indicate
         that the back end is alive.
       The default behavior is a TCP connect, to the back end's IP, at
       the back end's port. Use "--backend-check connect::" to reset
       previous flags to the default.
  --backend-timeout SEC, -t SEC
       Defines network read timeouts for back ends, default 30 sec. Use 0 to
       prevent timing out. Use "--backend-timeout RSEC:WSEC" to
       specify separate timeouts for reads and writes, default 30:3. 
  --buffer-size SIZE, -B size
      Sets the network buffer size, default is 2048 (in bytes)
  --checkup-interval SEC, -c SEC
       Defines the back end checking period. Each SEC seconds, every back end
       is checked whether it is alive. Default is 0 (off).
  --client-timeout SEC, -T SEC
       Defines network read timeouts for clients, default 30 sec. Use 0 to
       prevent timing out. Use "--client-timeout RSEC:WSEC" to specify
       separate timeouts for reads and writes, default 30:5
  --close-sockets-fast, -C
      Sockets are closed faster to avoid TIME_WAIT states.
  --debug, -D
       Sets debugging on, more verbosity on top of --verbose
  --defer-time USEC, -u USEC
       If a connection is going to be deferred due to hitting the "soft" rate
       (see --soft-maxconnrate), then this option sets how long the deferral
       will last, in microseconds.  Default is 500000 (0.5 seconds).
  --deny-from MASK, -A mask
       Deny clients that match MASK.
  --dispatch-mode METHOD, -d METHOD
       Defines how to dispatch over back ends, the method may be:
       f, first-available - first live back end gets all traffic
       e:EXT, external:EXT - external program EXT is queried
       h, strict-hashed-ip - client IP is hashed to determine a back end,
         the client is denied when back end is down.
       H, lax-hashed-ip - client IP is hashed, fallback to least-connections
     	 when target back end is down
       l, least-connections - back end with least connections is taken
       r, round-robin - back ends take turns
       L, weighted-load - randomly picks from back end with favor given
         to backends with lower load average. (NOTE: load average must
         be updated by the backend, e.g. using the web interface).
       s:SEC, strict-stored-ip:SEC - if client connected before within SEC
         seconds, then the same backend is used. Client is denied if
         that backend is down. Else a new is found by least-connections.
       S:SEC, lax-stored-ip:SEC - same as strict-stored-ip, but falls back
       	 to least-connections when a previously used back end is down.
       Default method is l (least-connections). When external mode is selected,
       program EXT is started with arguments <nbackends> <b0> <b0-availability>
       <b0-connections> (b0 repeated for all back ends). Here <b0> is the back
       end definition, eg. "10.1.1.1:80"; <b0-availablility> is "available" or
       "unavailable", <b0-connections> is the nr. of connections. The program
       must reply with a back end number (0..max) on stdout.
  --dns-cache-timeout SEC, -F SEC
       DNS results for back end hostnames are cached for SEC seconds.
       The default is 3600 (1 hour). Use 0 to suppress.
  --foreground, -f
       Suppresses forking/threading, only for debugging. Also suppresses
       wakeups (--wakeup-interval), checkups (--checkup-interval) and
       the webinterface (--web-interface). 
  --hard-maxconn-excess PROGRAM, -E PROGRAM
       When a client exceeds the hard maxconnection rate, PROGRAM is
       invoked with the client's IP as argument. The program may e.g.
       invoke iptables to block the offending IP.
  --hard-maxconnrate MAXCONS, -R MAXCONS
       Sets the "HARD" maximum average number of connections per IP allowed
       within a given time period (see -U, --time-interval).  If a
       particular IP exceeds this number, then their connection is
       immediately closed. Default is 0 (disabled).  If both the
       "soft" and "hard" rates are set, and the "hard" rate is lower
       than the "soft" rate, then only the "hard" rate is obeyed.
  --help, -?, -h
       This text.
  --host-match HOST, -M HOST
       Subsequently stated backends only apply when clients request a
       matching host. Only available when the server is in http mode.
  --log-traffic-dir DIR, -l DIR
       Log passing traffic with dumps in DIR. Only for debugging, slows
       down the balancer.
  --max-connections MAX, -m MAX
       Sets the maximum number of connections to the balancer. Default is 0,
       no maximum.
  --onend CMD, -Z CMD
       Runs CMD after successful termination of a client. For the
       arguments of CMD see -y.
  --onfail CMD, -y CMD
       Runs CMD when XR fails to connect to a back end. The arguments
       to the command are: the client's IP address, and the back end address.
  --onstart CMD, -z CMD
       Runs CMD just before letting a back end handle a client's connection.
       For the arguments of CMD see -y.
  --pidfile FILE, -p FILE
       FILE is written with the process id of XR upon startup, and
       removed upon exit.       
  --prefix-timestamp, -P
       Messages (verbose, debug, error etc.) are prefixed with a time stamp.
  --quit-after REQUESTS, -Q REQUESTS
       Stops the balancer after REQUESTS hits. For debugging / loadtesting.
  --remove-reservations, -G
       In stored-ip algorithms, outstanding reservations for expected
       clients are removed when no more back ends are available.
  --replace-host-header HDR, -I HDR
       Inserts "Host: <backend>" into back end bound HTTP messages.
       Pre-existing Host headers are overwritten. The value of <backend> is
       the server name as in the setting of --backend (-b).
  --server TYPE:IPADDRESS:PORT, -S TYPE:IPADDRESS:PORT
       Specifies the server. TYPE is tcp or http or udp. IPADDRESS is the IP
       address to listen to. PORT defines the TCP port to listen; when port
       is 0, XR will listen to stdin (inetd-mode, not available for udp).
       Default: tcp:0:10000 (TCP balancing, on all interfaces, via port 10000).
  --soft-maxconn-excess PROGRAM, -e PROGRAM
       When a client exceeds the soft maxconnection rate, PROGRAM is
       invoked with the client's IP as argument.
  --soft-maxconnrate MAXCONS, -r MAXCONS
       Sets the "SOFT" maximum average number of connections per IP allowed
       within a given time period (see -U, --time-interval).  If a
       particular IP exceeds this number, then their connection is
       deferred (see -u, --defer-time).  Default is 0 (disabled).
  --sticky-http, -S
       Enables sticky HTTP sessions by injecting XRTarget cookies into HTTP
       streams. Only effective with "--server http:...."
  --time-interval SEC, -U SEC
       If either --soft-maxconnrate or --hard-maxconnrate is specified, this
       option allows you to specify the time period to which those numbers of
       connections apply.  For example,
       "--soft-maxconnrate 200 --time-interval 60" would trigger the
       "soft" limit on any IP attempting more than 200 connections in
       any 60 second period.  Default is 1 (second). 
  --tryout, -n
       Validates all flags and stops; does not start the balancer.
  --url-match URL, -j URL
       Subsequently stated backends only apply when clients request a
       matching URL. Only available when the server is in http mode.
  --web-interface IP:PORT, -W IP:PORT
       Starts a web interface on specified IP address and port.
  --verbose, -v
       Increases verbosity, default is silent operation.
  --version, -V
       Shows the version info, and author/maintainer contacts (for reporting
       bugs).
  --wakeup-interval SEC, -w SEC
       Defines wakeup period (rechecking) in seconds, of unavailable back
       ends. Default is 5. Use -w0 to suppress.

XR's messages are sent to stderr. Invoke XR daemons using something like
"xr --backend ... [other flags] 2>&1 | logger &", or use xrctl.

