Using ldirectord

Introduction
This should be just enough information to get you up and running with Pacemaker managing ldirectord and a virtual IP address.

Configure ldirectord
Create /etc/ha.d/ldirectord.cf on all nodes. The configuration for a hypothetical TCP service running on the virtual IP 192.168.1.100 port 8888, with real servers 192.168.1.10 and 192.168.1.20, might look something like this:

checktimeout=3 checkinterval=5 autoreload=yes logfile="/var/log/ldirectord.log" quiescent=yes virtual=192.168.1.100:8888 real=192.168.1.10:8888 gate real=192.168.1.20:8888 gate scheduler=wrr protocol=tcp checktype=connect checkport=8888

For more detail on the above, refer to the ldirectord man page.

Configure Pacemaker
Using the crm shell:

primitive ip ocf:heartbeat:IPaddr2 \ op monitor interval="60" timeout="20" \ params ip="192.168.1.100" lvs_support="true" primitive ip-lo ocf:heartbeat:IPaddr2 \ op monitor interval="60" timeout="20" \ params ip="192.168.1.100" nic="lo" cidr_netmask="32" primitive lvs ocf:heartbeat:ldirectord \ op monitor interval="20" timeout="10" group ip-lvs ip lvs clone c-ip-lo ip-lo meta interleave="true" colocation lo-never-lvs -inf: c-ip-lo ip-lvs

This gives you the virtual IP address and ldirectord running together in a group (ip-lvs) on one node, and the same virtual IP address assigned to the loopback address on all other nodes. This is necessary to make the routing work correctly.

End Result
============ Last updated: Tue Nov 30 18:25:35 2010 Stack: openais Current DC: node-0 - partition with quorum Version: 1.1.4-fe6a4a99ffe5275ddbdc547e43f2eabd7cc56095 2 Nodes configured, 2 expected votes 2 Resources configured. ============ Online: [ node-0 node-1 ] Full list of resources: Resource Group: ip-lvs ip (ocf::heartbeat:IPaddr2):      Started node-1 lvs       (ocf::heartbeat:ldirectord):    Started node-1 Clone Set: c-ip-lo [ip-lo] Started: [ node-0 ] Stopped: [ ip-lo:1 ]