Using ldirectord


This should be just enough information to get you up and running with Pacemaker managing ldirectord and a virtual IP address. It does not cover configuring the actual service you want load-balanced.

Configure ldirectord

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

	real= gate
	real= gate

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="" lvs_support="true"
 primitive ip-lo ocf:heartbeat:IPaddr2 \
   op monitor interval="60" timeout="20" \
   params ip="" 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 ]