Link to home
Start Free TrialLog in
Avatar of binguyendl
binguyendl

asked on

Using 2 linux boxs with dynamic Ip to set up Load balancing Servers

Hi all Expert!

I have a difficult question, I can't find solution though Google or any forum, so need your helo :D
I hav a website that running on a shared hosting, but now I want to use it (shared hosting) just for redirect from http://domain.com to http://website.domain.com. Script using to redirect count how many request per time, then it redirect request to 1 of 2 linux webservers or both of them.

Problem is I already setup two web server, but I used dynamic IP, not statis IP. Can I set up Load Balance using 2 Linux Boxs with dynamic IP? and how? I'm running Ubuntu on both servers, using Apache 2.x.

Thank you for all of ur help!

-n
Avatar of Tintin
Tintin

Where are the two web servers you setup running?  Are they also on shared hosting?

Given your limitations of shared hosting and dynamic IP addresses, probably the best load balancing you can hope for is to configure DNS round robin (if possible)
By dynamic do you mean you have dhcp giving out internal addresses or you are using dynamic public addresses that change ?

If it is public ones then you can get round this using a service like no-ip.com
If it is internal addresses then reconfigure them as fixed.

You can have a single server that forwards to 2 different servers either in the same rack or elsewhere.  This does howver give you a single point of fail and means that this box still has to process every request so it is not really load balancing.
Avatar of binguyendl

ASKER

I already setup 2 servers, using dynamic public Ip, 2 servers is public and anyone can access using http://server1.com and http://server2.com. This is 2 servers, not shared hosting, I use dyndns.com dynamic dns.

Now I don't know how to use these servers to setup Load balancing, maybe when user type in address bar: http://mysite.com, user will visite http://mysite.com what hosted in one shared hosting, I user a php script to count how many request per time, then it redirect requests to 1 of 2 linux webservers or both of them.

thanks!

Best bet.... get 2 fixed IPs.  It shouldn't cost much and then you can do simple load balancing very easily by doing a round robin DNS.
You can do this with dyndns.com (only with fixed IPs) or using your own dns service.

If you really can not do this then you have two options.

Option 1.   Have a third box as the landing sote and this then forwards to the other two boxes.  This will be expensive but gives you real load balancing and makes it compatible (see below).  This could be a server or a dedicated hardware load balancer.

Option 2.   Have one of the boxes serve as the landing site.  This will be on port 80 (or 443 if you are doing SSL).  When it lands there you use a script to redirect to the two boxes.   You will then need to move the real web server to a non standard port like 88 or 8080.  This will means one or two people will not be able to get to the site as they are behind proxies or using devices that will not work off port 80 (like some phones).  It also doesn't look as professional.
You could let the server go and get the traffic and pass it on using the first address but then you have lost all loadbalancing as this box is doing work for every request.

as stated above they will let you do it with static addresses but not dynamic ones
there is no solution with dynamic IP?
No not a real solution.  You should not use dynamic addesses for any hosting really.  If it is a little test you can use dynamic addresses just to get running but as you are talking about load balancing it is obviously more than a test so upgrade to real static IPs.  It really is the only path.
Shared hosting solutions weren't designed for high availability, load balancing or clustering solutions. If/when you are growing to that level of inbound traffic, I recommend to start looking at dedicated, co-location hosting sites where you aren't 'sharing' a server environment with someone else. Then you can look at Linux platforms like Red Hat Enterprise 5.x or CentOS 5.x which were designed for these types of environments.
You don't understand. I already had two servers which are running Linux, and every one can access to these boxes through Internet + 1 shared hosting.

I want this shared hosting act as a bridge to redirect requests to 1 or both 2 Linux Servers ( this 2 servers has dynamic "public IP").

@edster9999: Thank you, and explain my trouble:
I use everydns, www1.domain.com points to server1, www2.domain.com points to server2. I update dynamic IP by my own shell script, it's working well.

All I want is Load balancing between 2 servers using "Dynamic IP".

ASKER CERTIFIED SOLUTION
Avatar of edster9999
edster9999
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Maybe It's my solution. THank you!