File: usage.txt

package info (click to toggle)
crossroads 2.65-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,664 kB
  • ctags: 355
  • sloc: cpp: 4,212; perl: 1,658; xml: 269; makefile: 186; sh: 46
file content (181 lines) | stat: -rw-r--r-- 9,892 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

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.