1LDIRECTORD(8) User Contributed Perl Documentation LDIRECTORD(8)
2
3
4
6 ldirectord - Linux Director Daemon
7
8 Daemon to monitor remote services and control Linux Virtual Server
9
11 ldirectord [-d⎪--debug] [--] [configfile]
12 start⎪stop⎪restart⎪reload⎪status
13
14 ldirectord [-h⎪-?⎪--help⎪-v⎪--version]
15
17 ldirectord is a daemon to monitor and administer real servers in a
18 cluster of load balanced virtual servers. ldirectord typically is
19 started from heartbeat but can also be run from the command line. On
20 startup ldirectord reads the file /etc/ha.d/conf/configuration. After
21 parsing the file, entries for virtual servers are created on the LVS.
22 Now at regular intervals the specified real servers are monitored and
23 if they are considered alive, added to a list for each virtual server.
24 If a real server fails, it is removed from that list. Only one instance
25 of ldirectord can be started for each configuration, but more instances
26 of ldirectord may be started for different configurations. This helps
27 to group clusters of services. Normally one would put an entry inside
28 /etc/ha.d/haresources
29
30 nodename virtual-ip-address ldirectord::configuration
31
32 to start ldirectord from heartbeat.
33
35 configuration: This is the name for the configuration as specified in
36 the file /etc/ha.d/conf/configuration
37
38 -d⎪--debug Don't start as daemon and log verbosly.
39
40 -h⎪--help Print user manual and exit.
41
42 -v⎪--version Print version and exit.
43
44 start the daemon for the specified configuration.
45
46 stop the daemon for the specified configuration. This is the same as
47 sending a TERM signal to the running daemon.
48
49 restart the daemon for the specified configuration. The same as stop‐
50 ping and starting.
51
52 reload the configuration file. This is only useful for modifications
53 inside a virtual server entry. It will have no effect on adding or
54 removing a virtual server block. This is the same as sending a HUP sig‐
55 nal to the running daemon.
56
57 status of the running daemon for the specified configuration.
58
60 Description of how to write configuration files
61
62 virtual = (ip_address⎪hostname:portnumber⎪servicename)⎪firewall-mark
63
64 Defines a virtual service by IP-address (or hostname) and port (or ser‐
65 vicename) or firewall-mark. A firewall-mark is an integer greater than
66 zero. The configuration of marking packets is controled using the "-m"
67 option to ipchains(8). All real services and flags for a virtual ser‐
68 vice must follow this line immediately and be indented.
69
70 checktimeout = n
71
72 Timeout in seconds for connect checks. If the timeout is exceeded then
73 the real server is declared dead.
74
75 If defined in a virtual server section then the global value is over‐
76 ridden.
77
78 Default: 5 seconds
79
80 connecttimeout = n
81
82 Not used.
83
84 negotiatetimeout = n
85
86 Timeout in seconds for negotiate checks.
87
88 If defined in a virtual server section then the global value is over‐
89 ridden.
90
91 Default: defined by the operating system
92
93 checkinterval = n
94
95 Defines the number of second between server checks.
96
97 Default: 10 seconds
98
99 checkcount = n
100
101 The number of times a check will be attmpted before it is considered to
102 have failed. Only works with ping checks. Note that the checktimeout is
103 additive, so if checkcount is 3 and checktimeout is 2 seconds, then a
104 total of 6 seconds worth of timeout will occur becore the check fails.
105
106 If defined in a virtual server section then the global value is over‐
107 ridden.
108
109 Default: 1
110
111 autoreload = yes⎪no
112
113 Defines if <ldirectord> should continuously check the configuration
114 file for modification. If this is set to 'yes' and the configuration
115 file changed on disk and its modification time (mtime) is newer than
116 the previous version, the configuration is automatically reloaded.
117
118 Default: no
119
120 callback = "/path/to/callback"
121
122 If this directive is defined, ldirectord automatically calls the exe‐
123 cutable /path/to/callback after the configuration file has changed on
124 disk. This is useful to update the configuration file through scp on
125 the other heartbeated host. The first argument to the callback is the
126 name of the configuration.
127
128 This directive might also be used to restart ldirectord automatically
129 after the configuration file changed on disk. However, if autoreload is
130 set to yes, the configuration is reloaded anyway.
131
132 fallback = ip_address⎪hostname[:portnumber⎪sercvicename]
133 [gate⎪masq⎪ipip]
134
135 the server onto which a webservice is redirected if all real servers
136 are down. Typically this would be 127.0.0.1 with an emergency page.
137
138 If defined in a virtual server section then the global value is over‐
139 ridden.
140
141 logfile = "/path/to/logfile"⎪syslog_facility
142
143 An alternative logfile might be specified with this directive. If the
144 logfile does not have a leading '/', it is assumed to be a syslog(3)
145 facility name.
146
147 Default: log directly to the file /var/log/ldirectord.log.
148
149 emailalert = "emailaddress"
150
151 A valid email address for sending alerts about the changed connection
152 status to any real server defined in the virtual service. This option
153 requires perl module MailTools to be installed. Automatically tries to
154 send email using any of the built-in methods. See perldoc Mail::Mailer
155 for more info on methods.
156
157 If defined in a virtual server section then the global value is over‐
158 ridden.
159
160 emailalertfreq = n
161
162 Delay in seconds between repeating email alerts while any given real
163 server in the virtual service remains inaccessible. A setting of zero
164 seconds will inhibit the repeating alerts. The email timing accuracy of
165 this setting is dependent on the number of seconds defined in the
166 checkinterval configuration option.
167
168 If defined in a virtual server section then the global value is over‐
169 ridden.
170
171 Default: 0
172
173 emailalertstatus = all⎪none⎪starting⎪running⎪stopping⎪reloading,...
174
175 Comma delimited list of server states in which email alerts should be
176 sent. all is a short-hand for "starting,running,stopping,reloading".
177 If none is specified, no other option may be specified, otherwise
178 options are ored with each other.
179
180 If defined in a virtual server section then the global value is over‐
181 ridden.
182
183 Default: all
184
185 execute = "configuration"
186
187 Use this directive to start an instance of ldirectord for the named
188 configuration.
189
190 supervised = yes⎪no
191
192 If yes, then ldirectord does not go into background mode. All log-mes‐
193 sages are redirected to stdout instead of a logfile. This is useful to
194 run ldirectord supervised from daemontools. See http://untrou‐
195 bled.org/rpms/daemontools/ or http://cr.yp.to/daemontools.html for
196 details.
197
198 Default: no
199
200 quiescent = yes⎪no
201
202 If yes, then when real or failback servers are determined to be down,
203 they are not actually removed from the kernel's LVS table. Rather,
204 their weight is set to zero which means that no new connections will be
205 accepted. This has the side effect, that if the real server has persis‐
206 tent connections, new connections from any existing clients will con‐
207 tinue to be routed to the real server, until the persistant timeout can
208 expire. See ipvsadm for more information on persistant connections.
209
210 If no, then the real or failback servers will be removed from the ker‐
211 nel's LVS table. The default is yes.
212
213 If defined in a virtual server section then the global value is over‐
214 ridden.
215
216 Default: yes
217
218 Section virtual
219
220 The following commands must follow a virtual entry and must be indented
221 with a minimum of 4 spaces or one tab.
222
223 real = ip_address⎪hostname[->ip_address⎪hostname][:portnumber⎪service‐
224 name] gate⎪masq⎪ipip [weight] ["request", "receive"]
225
226 Defines a real service by IP-address (or hostname) and port (or servi‐
227 cename). If the port is omitted then a 0 will be used, this is intended
228 primarily for fwmark services where the port for real servers is
229 ignored. Optionally a range of IP addresses (or two hostnames) may be
230 given, in which case each IP address in the range will be treated as a
231 real server using the given port. The second argument defines the for‐
232 warding method, must be gate, ipip or masq. The thrid argument is
233 optional and defines the weight for that real server. The last two
234 arguments are optional. They define a request-receive pair to be used
235 to check if a server is alive. They override the request-receive pair
236 in the virtual server section. These two strings must be quoted. If the
237 request string starts with http://... the IP-address and port of the
238 real server is overridden, otherwise the IP-address and port of the
239 real server is used.
240
241 More than one of these entries may be inside a virtual section. The
242 checktimeout, negotiatetimeout, checkcount, fallback, emailalert,
243 emailalertfreq and quiescent options listed above may also appear
244 inside a virtual section, in which case the global setting is overrid‐
245 den.
246
247 checktype = negotiate⎪connect⎪N⎪ping⎪off⎪on
248
249 Type of check to perform. Negotiate sends a request and matches a
250 receive string. Connect only attemts to make a TCP/IP connection, thus
251 the request and receive strings may be omitted. If checktype is a num‐
252 ber then negotiate and connect is combined so that after each N connect
253 attempts one negotiate attempt is performed. This is useful to check
254 often if a service answers and in much longer intervalls a negotiating
255 check is done. Ping means that ICMP ping will be used to test the
256 availability of real servers. Ping is also used as the connect check
257 for UDP services. Off means no checking will take place and no real or
258 fallback servers will be activated. On means no checking will take
259 place and real servers will always be activated. Default is negotiate.
260
261 service =
262 ftp⎪smtp⎪http⎪pop⎪pops⎪nntp⎪imap⎪imaps⎪ldap⎪https⎪dns⎪radius⎪mysql⎪pgsql⎪sip⎪none
263
264 The type of service to monitor when using checktype=negotiate. None
265 denotes a service that will not be monitored.
266
267 Default:
268
269 * Virtual server port is 21: ftp
270 * Virtual server port is 25: smtp
271 * Virtual server port is 53: dns
272 * Virtual server port is 80: http
273 * Virtual server port is 110: pop
274 * Virtual server port is 119: nntp
275 * Virtual server port is 143: imap
276 * Virtual server port is 389: ldap
277 * Virtual server port is 443: https
278 * Virtual server port is 993: imaps
279 * Virtual server port is 995: pops
280 * Virtual server port is 1812: radius
281 * Virtual server port is 3306: mysql
282 * Virtual server port is 5432: pgsql
283 * Virtual server port is 5060: sip
284 * Otherwise: none
285
286 checkport = n
287
288 Number of port to monitor. Sometimes check port differs from service
289 port.
290
291 Default: port specified for each real server
292
293 request = "uri to requested object"
294
295 This object will be requested each checkinterval seconds on each real
296 server. The string must be inside quotes. Note that this string may be
297 overridden by an optional per real-server based request-string.
298
299 For a DNS check this should the name of an A record, or the address of
300 a PTR record to look up.
301
302 For a MySQL or PostgeSQL checks, this should be a SQL query. The data
303 returned is not checked, only that the answer is one or more rows.
304 This is a required setting.
305
306 receive = "regexp to compare"
307
308 If the requested result contains this regexp to compare, the real
309 server is declared alive. The regexp must be inside quotes. Keep in
310 mind that regexps are not plain strings and that you need to escape the
311 special characters if they should as litterals. Note that this regexp
312 may be overridden by an optional per real-server based receive regexp.
313
314 For a DNS check this should be any one the A record's addresses or any
315 one of the PTR record's names.
316
317 For a MySQL check, the receive setting is not used.
318
319 httpmethod = GET⎪HEAD
320
321 Sets the HTTP method which should be used to fetch the URI specified in
322 the request-string. GET is the method used by default if the parameter
323 is not set. If HEAD is used, the receive-string should be unset.
324
325 Default: GET
326
327 virtualhost = "hostname"
328
329 Used when using a negotiate check with HTTP or HTTPS. Sets the host
330 header used in the HTTP request. In the case of HTTPS this generally
331 needs to match the common name of the SSL certificate. If not set then
332 the host header will be derived from the request url for the real
333 server if present. As a last resort the IP address of the real server
334 will be used.
335
336 login = "username"
337
338 Username to use to login to FTP, IMAP, LDAP, MySQL, POP, PostgreSQL.
339
340 For Radius the passwd is used for the attribute User-Name.
341
342 For SIP, the username is used as both the to and from address for an
343 OPTIONS query.
344
345 Default:
346
347 * FTP: Anonymous
348 * MySQL and PostgreSQL: Must be specified in the configuration
349 * SIP: ldirectord\@<hostname>, hostname is derived as per the passwd
350 option below.
351 * Otherwise: empty string, which denotes that case authentication will
352 not be attempted.
353
354 passwd = "password"
355
356 Password to use to login to FTP, IMAP, LDAP, MySQL, POP, PostgreSQL and
357 SIP servers.
358
359 For Radius the passwd is used for the attribute User-Password.
360
361 Default:
362
363 * FTP: ldirectord\@<hostname>, where hostname is the environment vari‐
364 able HOSTNAME evaluated at run time, or sourced from uname if unset.
365 * Otherwise: empty string. In the case of LDAP, MySQL and PostgreSQL
366 this means that authentication will not be performed.
367
368 database = "databasename"
369
370 Database to use for MySQL and PostgreSQL servers, this is the database
371 that the query (set by receive above) will be performed against. This
372 is a required setting.
373
374 secret = "radiussecret"
375
376 Secret to use for Radius servers, this is the secret used to perform an
377 Access-Request with the username (set by login above) and passwd (set
378 by passwd above).
379
380 Default: empty string
381
382 scheduler = scheduler_name
383
384 Scheduler to be used by LVS for loadbalancing. For an information on
385 the available sehedulers please see the ipvsadm(8) man page.
386
387 Default: "wrr"
388
389 persistent = n
390
391 Number of seconds for persistent client connections.
392
393 netmask = w.x.y.z
394
395 Netmask to be used for granularity of persistent client connections.
396
397 protocol = tcp⎪udp⎪fwm
398
399 Protocol to be used. If the virtual is specified as an IP address and
400 port then it must be one of tcp or udp. If a firewall mark then the
401 protocol must be fwm.
402
403 Default:
404
405 * Virtual is an IP address and port, and the port is not 53: tcp
406 * Virtual is an IP address and port, and the port is 53: udp
407 * Virtual is a firewall mark: fwm
408
410 /etc/ha.d/ldirectord.cf
411
412 /var/log/ldirectord.log
413
414 /var/run/ldirectord.configuration.pid
415
416 /etc/services
417
419 ipvsadm, heartbeat
420
421 Ldirectord Web Page: http://www.vergenet.net/linux/ldirectord/
422
424 Horms <horms@verge.net.au>
425
426 Jacob Rief <jacob.rief@tiscover.com>
427
428
429
430perl v5.8.8 2007-01-21 LDIRECTORD(8)