ldirectord - Linux Director Daemon Daemon to monitor remote services and control Linux Virtual Server ldirectord configuration [-d] [-h] start⎪stop⎪restart⎪reload⎪status ldirectord is a daemon to monitor and administer real servers in a cluster of load balanced virtual servers. ldirectord typically is started from heartbeat but can also be run from the command line. On startup ldirectord reads the file /etc/ha.d/conf/configuration. After parsing the file, entries for virtual servers are created on the LVS. Now at regular intervals the specified real servers are monitored and if they are considered alive, added to a list for each virtual server. If a real server fails, it is removed from that list. Only one instance of ldirectord can be started for each configuration, but more instances of ldirectord may be started for different configurations. This helps to group clusters of services. Normally one would put an entry inside /etc/ha.d/haresources nodename virtual-ip-address ldirectord::configuration to start ldirectord from heartbeat. configuration: This is the name for the configuration as specified in the file /etc/ha.d/conf/configuration -d Don't start as daemon. Useful for debugging. -h Help. Print user manual of ldirectord. start the daemon for the specified configuration. stop the daemon for the specified configuration. This is the same as sending a TERM signal the the running daemon. restart the daemon for the specified configuration. The same as stopping and starting. reload the configuration file. This is only useful for modifications inside a virtual server entry. It will have no effect on adding or removing a virtual server block. This is the same as sending a HUP signal to the running daemon. status of the running daemon for the specified configuration.
Description how to write configuration files virtual = x.y.z.w:p⎪f Defines a virtual service by IP-address and port or firewall-mark. A firewall-mark is an integer greater than zero. The configuration of marking packets is controled using the "-m" option to ipchains(8). All real services and flags for a virtual service must follow this line immediately and be indented. checktimeout = n Defines the number of second until a real server is declared dead. Default is 5 seconds. If defined in virtual server section then the global value is overridden. connecttimeout = n Not used. negotiatetimeout = n Defines the number of seconds to wait for TCP/IP timeouts. Default is defined by the operating system. If defined in virtual server section then the global value is overridden. checkinterval = n Defines the number of second between server checks. Default is 10 seconds. autoreload = [yes⎪no] Defines if <ldirectord> should continuously check the configuration file for modification. If this is set to 'yes' and the configuration file changed on disk, the configuration is automatically reloaded. Default is no. callback = "/path/to/callback" If this directive is defined, ldirectord automatically calls the executable /path/to/callback after the configuration file has changed on disk. This is useful to update the configuration file through scp on the other heartbeated host. The first argument to the callback is the name of the configuration. This directive might also be used to restart ldirectord automatically after the configuration file changed on disk. However, if autoreload is set to yes, the configuration is reloaded anyway. fallback = x.y.z.w:p the server onto which a webservice is redirected if all real servers are down. Typically this would be 127.0.0.1 with an emergency page. This directive may also appear within a virtual server, in which case it will overide the global fallback server, if set. logfile = "/path/to/logfile" an alternative logfile might be specified with this directive. execute = "configuration" Use this directive to start an instance of ldirectord for the named configuration. foreground If this directive is specified, the daemon does not go into background mode. This is useful to run ldirectord for instance from daemontools.
Section virtual The following commands must follow a virtual entry and must be indented with a minimum of 4 spaces or one tab. real = w.x.y.z[-a.b.c.d]:p gate⎪masq⎪ipip [weight] ["request", "receive"] Defines a real service by IP-address and port. Optionally a range of IP addresses may be given, in which case each IP address in the range will be treated as a real server using the given port. The second argument defines the forwarding method, must be gate, ipip or masq. The thrid argument is optional and defines the weight for that real server. The last two arguments are optional. They define a request-receive pair to be used to check if a server is alive. They override the request-receive pair in the virtual server section. These two strings must be quoted. If the request string starts with http://... the IP-address of the real server is overridden, otherwise the IP-address of the real server is used. This may be used to send a request over a transparent proxy.
More than one of these entries may be inside a virtual section: checktype = negotiate⎪connect⎪N⎪off Type of check to perform. Negotiate sends a request and matches a receive string. Connect only attemts to make a TCP/IP connection, thus the the request and receive strings may be omitted. Type of check to perform. Negotiate means to send request and expect receive strings. Connect means raw tcp/ip connection, here the request and receive string can be omitted. If checktype is a number then negotiate and connect is combined so that after each N connect attempts one negotiate attempt is performed. This is useful to check often if a service answers and in much longer intervalls a negotiating check is done. Off means no checking will take place and no real or fallback servers will be activated. Default is negotiate. service = http⎪https⎪ftp⎪none The type of service to monitor. None denotes a service that will not be monitored. If the port specfied for the virtual server is 80 the default service is http. If the port specified is 443 the default service is https. If the port specified is 21 the default service is ftp. Otherwise the default service is none. checkport = n Number of port to monitor. Sometimes check port differs from service port. Default is port specified for the real server. request = "uri to requested object" This object will be requested each checkinterval seconds on each real server. The string must be inside quotes. Note that this string may be overridden by an optional per real-server based request-string. receive = "string to compare" If the requested result contains this string to compare, the real server is declared alive. The string must be inside quotes. Note that this string may be overridden by an optional per real-server based receive-string. login = "username" Username to use to login to FTP server. Default is anonymous. passwd = "password" Password to use to login to FTP server. Default is ldirectord\@<hostname>, where hostname is the environment variable HOSTNAME evaluated at run time. scheduler = rr⎪wrr⎪lc⎪wlc⎪lblc⎪lblcr Scheduler to be used for loadbalance. Default is "wrr". persistent = n Number of seconds for persistent client connections. netmask = w.x.y.z Netmask to be used for granularity of persistent client connections. protocol = tcp⎪udp⎪fwm Protocol to be used. If the virtual is specified as an IP address and port then it must be one of tcp or udp and will default to tcp. If a firewall mark then the protocol must be fwm, which is the default. /etc/ha.d/ldirectord.cf /etc/ha.d/conf/configuration /var/log/ldirectord.log /var/run/ldirectord.configuration.pid /etc/services ipvsadm, heartbeat Jacob Rief <[email protected]> Horms <[email protected]>, <[email protected]> Skliarouk Peter <[email protected]>