Heartbeat plus ldirectord
Introduction
ldirectord ldirectord is a daemon to monitor and administer real servers in a LVS cluster of load balanced virtual servers. ldirectord typically used as a resource for heartbeat , but can also be run from the command line.
A LVS cluster consists or one or more virtual services each of which may have zero or more real servers. The IP address of a virtual service is what end-users connect to and is typically advertised over DNS. When a connection is made to a virtual service, it is allocated a real server, and all packets for this connection are forwarded to this real server. A more detailed overview of LVS can be found here.
ldirectord has a configuration file which specifies the virtual services and their associated real servers. When ldirectord is initialised it creates the virtual services for the clutster.
ldirectord monitors the health of the real servers by periodically requesting a known URL and checking that the response contains an expected response. If a real server fails then the server is removed and will be reactivated once it comes back on line. If all the real servers are down then a fall-back server is inserted into the pool, which will made quiescent one of the real web servers comes back on line. Typically, the fall-back server is localhost. If an HTTP virtual service is being provided then it is useful to run an Apache HTTP server that returns a page indicating that the service is temporarily inaccessible.