| Author |
Message |
guitarman fourth grade
Joined: 04 Nov 2005 Posts: 728
|
Posted: Sun May 20, 2007 11:14 pm Post subject: networking 2 servers? how to? |
|
|
When i was doing research on my ecommerce course, I was wondering how could we hook up two dedicated server together and make it as a load balancing?
In usual case, we only use one web server at a time, but if the server get very heavy load like Digg does, one server would not be enough. So in this case, how could we hook up two server together and use load balancing between the two?
cheers
|
|
| Back to top |
|
 |
HarryR first grade
Joined: 03 Apr 2007 Posts: 17 Location: United Kingdom
|
Posted: Sun May 20, 2007 11:44 pm Post subject: |
|
|
Hello guitarman,
You can do basic load balancing using only DNS round robin.
For example, for www.example.com you'd have two A records, 192.168.1.1 and 192.168.1.2.
Each time the web browser needs a new connection to www.example.com, it will get either one of the IP addresses (and alternate between the two for each request).
Using this you can effectively distribute the load between the two servers without any proprietary hardware or software sitting infront of them.
Alternatively you could use something like Haproxy or Pound which are software load balancers. These would sit on a separate server(s) infront of your cluster and distribute HTTP requests to different servers based on their load, the URL and any other number of factors.
Thirdly you could use something like Linux Vserver and heartbeat on 2-3 servers sitting infront of your cluster to balance TCP connections between servers in your cluster based on their load.
Generally I'd say that the first option would be your best bet, but for really heavy loads I'd be using HAproxy or Pound on a few machines with heartbeat failover.
However, with only two servers you're going to be constrained to using round robin DNS and (if you need faster failover) heartbeat too.
|
|
| Back to top |
|
 |
guitarman fourth grade
Joined: 04 Nov 2005 Posts: 728
|
Posted: Mon May 21, 2007 1:17 am Post subject: |
|
|
Harry, thanks!
So for first option, we only deal with DNS? i.e. to contact DNS to setup the two IPs address?
The Ips address is taken from the dedicated servers that i bought right?
|
|
| Back to top |
|
 |
|