Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to work out a solution in my head where two backend linux-servers run HTTP, SMTP, XMPP mirrored and should load balance connections between them.

My current solution is an OpenBSD box infront, that can of course be extended with carp to add more in the future to avoid single point of failure. Using PF I could have a pool of servers to send traffic to, using random or round-robin methods.

And using relayd I can remove non-functioning pool-servers from it.

But I would value the opinions of the community on this matter, so please tell me your best Unix load balancing solution for this type of environment.

One goal would be that a single server should be allowed to fail with minimal service interruption.

share|improve this question
    
What if the BSD box in front of those two backend boxes fails? Redundancy doesn't mean "Move the single point of failure one step down the line". –  Shadur Sep 28 '11 at 8:44
1  
That's why I mentioned carp, and in fact I have changed my solution to setting up two of those at the same time. –  Stefan Midjich Sep 28 '11 at 10:19
add comment

6 Answers 6

The most complete way to do this is to use Pacemaker+LVS.

LVS is short for Linux Virtual Server. Lots of info can be found at linux-ha.org Basically the linux kernel has a built in load balancer called IPVS. As such is is extremely well tested and supported. Its also been around for a looong time, (Kernel 2.0 days I believe).
There are numerous utilities for managing the load balancer such as ldirector and piranha. Ldirector is probably the most prominant one. What these utilities are responsible for doing is periodically health checking your back end servers and making sure theyre still there and operating properly. Should it find that the server is gone, it will remove that server from the kernel's IPVS table and effectively remove it from the pool. These utilities are by no means required, as you can interface directly with the IPVS table using ipvsadm.

Pacemaker is the successor to Heartbeat which has been the standard utility for clustering for a long time. Heartbeat has been deprecated in favor of Pacemaker (heartbeat is no longer being maintained), so while you can still use Heartbeat if you wish (it is definitely simpler to configure), its end is coming.
The reason I mention this utility is that without a pair of load balancers in the front, youre really just moving the single-point-of-failure somewhere else. Instead of a single backend server being able to fail, now a single load balancer can fail and youre in the same boat. Pacemaker will ensure that a load balancer is always running. Should the currently active load balancer fail, the other one will take over. An additional benefit of pacemaker is that it allows you to run both load balancers in an active/active setup if you have multiple IPs (heartbeat cannot do this).

share|improve this answer
add comment

To answer the question, Yes you can use Linux to load balance two other linux servers ( their services actually). I use Piranha to be more specific for this. Piranha is a managing layer on the top of LVS clustering system. The nice and detailed howto by Redhat is at http://www.redhat.com/support/resources/howto/piranha/

http://sourceware.org/piranha/

share|improve this answer
add comment

HAProxy has been compiled on a bunch of *nix platforms, including the BSDs and Solaris (and of course Linux). If your load balancer isn't running Linux, it's a very convenient and configurable piece of software. It knows about HTTP but can also balance any TCP service it knows nothing about. It can check servers and will remove from service any that aren't responsive (or aren't responsive enough).

It lives here: http://haproxy.1wt.eu/

There's one drawback to it: it only talks to the internal (back-end) servers via IPv4 (incoming IPv6 connections are load balanced fine, it's just the internal connection that's limited to IPv4). If your server farm is on a dual-stack setup, that's not an issue.

share|improve this answer
add comment

Another recent option using Linux is the IPVS project that is now included in the Linux kernel v2.6.38-rc3 or later.

It uses layer 4 switching in the kernel and is said to be - FAST.

More info here http://kb.linuxvirtualserver.org/wiki/IPVS

share|improve this answer
    
This answer is correct, but IPVS has been around WAY before 2.6.38. –  Patrick Oct 27 '11 at 1:34
add comment

We use a pair of virtual CentOS 5 servers that run lvs, lvs-kiss and heartbeat. The virtual servers theirselv reside in a XEN-cluster which can fail over to a different location.

One of the LVS-Servers is the active master, the other one the slave. On both serves both processes (master and slave) run permanentely so sessions get replicated all of the time.

If the active lvs-server goes down the other takes over and seamlessly serves the lb-connection to the previous target server.

share|improve this answer
add comment

I'm only familiar with a pure Linux combination of heartbeat and ldirector (both part of the linux virtual server project to IP tunnel traffic from a pair of front-ends to N back-ends, and to share/swap a front-end IP between two front-ends when one dies. It worked very well in the environment I used, but I'm not sure whether it is vulnerable to split-brain issues.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.