Configuring HAProxy with memcache with failover

Posted by Lawrie Matthews on Server Fault See other posts from Server Fault or by Lawrie Matthews
Published on 2013-06-27T16:11:29Z Indexed on 2013/06/27 16:22 UTC
Read the original article Hit count: 430

I'm configuring a new set of servers for an existing Wordpress site, and it's been requested that memcache be available and made more resilient. The idea proposed is to have HAProxy send requests to one of the two servers; if that memcache instance is inaccessible, then it should switch to the second, but should not switch back to the first if it comes back up unless the second is then unavailable.

This doesn't appear to be a particularly common use case and I've not found much along these lines except to possibly set up the first node with an enormous rise value, such as:

server server1 10.112.58.16:11211  check inter 5s fall 3 rise 99999999
server server2 10.112.58.19:11211  check backup

which falls over as expected when server1 is unavailable. It won't ever fall back to server1, though, even if server2 goes offline. Can this be made to work?

© Server Fault or respective owner

Related posts about haproxy

Related posts about high-availability