Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

failover for linux servers

Status
Not open for further replies.

pr0n603

Programmer
Dec 14, 2004
23
0
0
US
I have 2 servers running Debian, MySQL, Apache Tomcat and a Java webapp. They sit behind a NetGear router with port 8080 (http in this case) forwarded to Server A. I want to be able to do a couple of things:

1) if mysql/tomcat crash on server A, i want all trafit to go to server B and the webapp ther
2) if there is too much trafic on server A, have the trafit be distributed to server B
3) be able to manually switch traffic off from A to B and visa versa

I cant afford a hardware load balancer so i was wonderign if there is a way i can do this either with linux tools or some open source software. I know mysql has some sort of replication too but dont know waht thats about.

Thanks!
 
Well, looking at this with a K.I.S.S. approach. How about a DNS round-robin between the two servers? A. It will balance traffic between the two. B. Just eliminate server B from DNS if you want all traffic to server A or vise versa.

Have Fun

Fernando
 
MySQL replication is documented pretty well on mysql.com and is fairly easy to set up. That's one thing that you'll need.

True load balancing isn't going to happen without some type of load balancer. You could run a load balancer on each server, backed up by the other. That means that all traffic will actually go through one server, which will request http from itself & the other one in a load-balanced fashion. Round-robin DNS is also an option, but requires 2 public IP addresses.

Check out Heartbeat and mon for failover.
 
Round robin to me wouldn't be the best approach..

The issue that you could run into would be a client connecting, have a session established, then later down in that connection it might do a DNS lookup again, which might get handed back the other IP.. When it tries to connect to that alternate IP, the current session that the client had up, is no longer valid, therefore killing everything..


Which is why lgarner mentioned its not 'true load balancing'


BuckWeet
 
ahhh,

Iv heard of round robin but as BuckWeet mentioned, I thought the session problems would come up.

As for loadbalancers, do i need a hardware laodbalancer (like F5) or are there any software-type load balancers (preferably, of course, free) that would run on 1 server and redirect overload traffict to the other?

thank you ALL for your advice
 
hardware load balancer would be best..

but if it were software, you would need the device sitting in front of the 2 servers..

BuckWeet
 
so i would need a 3rd server running the load balancer and it would sit in front of the 2 servers?
 
Yes, and I'm almost certain that there are linux software load balancers that can run as part of a linux firewall implementation on the front-end box...

READ: low cost hardware load balancer...

UNLESS you feel you're going to REALLY be pushing the hardware balancing load, then you are probably doomed to buying^W^W^W going to need a more dedicated piece of gear.

You could really get nutty and put together a couple of low cost boxes on the front end and tie them together using heartbeat or something and have a paired firewall/load balancer implementation. I think there's a way that linux firewalls can be linked in such an HA manner using something Cisco-like... I'm babbling now,... good luck.


Hosting Solutions for Home or Business.
 
That's how I did it for an online trading site. Check out "linux virtual server" for the loadbalancer. has software that works with lvs for failover between the load balancers.
 
thanks for the advice guys. Ill check this stuff out and let you know how it came along.

happy new year!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top