I managed to set up a pacemaker-heartbeat cluster with a virtual IP address and a virtual instance of ldirectord, by gathering information from here, here and here. It seems that the proper way to use ldirectord
is to have two load-balancing servers in front of two apache servers, then doing some arp tricks to get the apache servers to respond to the virtual IP.
According to this blog post (starting from "the traditional way"), these arp tricks will not work on a two-server setup, and may cause infinite loops. He then suggests some solution which I didn't fully understand, but is keepalived-specific.
So my question is: is it possible to use a clustered ldirectord to load balance between apache instances on the very same two servers? Like this picture?
Keepalived is a different project than heartbeat.
I usually use heartbeat for high availability. For heartbeat, you can define the resources that will be owned by one machine at a time. The VIP is one of these resources that can "move" from one machine to another. AFAIK, heartbeat package does not provide load balancing. To implement load balancing, I can use another package like haproxy.
Yes, it is possible to use the very same two servers to act as a load balancer and web server.
Use keepalived.
It's the preferred software nowadays, ldirectord is unmaintained for several years now.
And yes, it is possible to do run a Two-Node setup.
However every real cluster needs three nodes, at least.