logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Running one website via two apache web servers?
Author
hydn79



Joined: 28 Apr 2007
Posts: 19

PostPosted: Sat 28 Apr '07 18:43    Post subject: Running one website via two apache web servers? Reply with quote

I've mirrored the htdocs to the 2nd server. And they file sync every 15 mins.

Problem:
server 1 is www.mysite.com with ip 123.123.123.1
server 2 is simply a different ip eg 123.123.123.2

What is the best method to share the load across the two apache servers?

I notice in the apache console there's a button "Connect" where you can "connect to a remote server". Can that be used to access the htdocs on Server 1 by apache web service on server 2?

Or even better, suggest the best way to lower some of the load on my web server as the 2nd box (mysql server) is almost idle. I've install apache on it but don't know how to connect the two.

I've spent the last two days searching and experimenting all over the web then I fond this place today and decided to give it a go. Thanks all.

Thanks,
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Sun 29 Apr '07 19:05    Post subject: Reply with quote

If you control the Domain Name Server (DNS) for www.mysite.com, the simplest way is to create two DNS records for your server. If you do not control the DNS server for your site, there are two other ways to achieve this:
load-balancing hardware or load-balancing software.

There are many options, but all of them tend to be a bit complex.
A good starting point for your research is the Wikipedia Load balancing page.

Another possibility is to set up a third Apache instance as www.mysite.com and have it proxy (i.e. forward)
all incoming requests to one of your two existing Apache instances in a round-robin fashion.
See the mod_proxy_balancer module documentation for how to do this.
This still has all requests going through a single Apache instance, so it may not be what you are looking for.

The "Connect" button in Apache console doesn't have anything to do with load balancing of incoming web requests.


-tom-
Back to top
hydn79



Joined: 28 Apr 2007
Posts: 19

PostPosted: Sun 29 Apr '07 19:16    Post subject: Reply with quote

thanks...

I want to send all request for images to the server to the 2nd server.
I will still need to add the 2nd server's ip to the A or cname record for the domain correct?

Also, if the IP's are 123.123.123.1 (Server A web server) 123.123.123.2 (Server B - images server)

How would I tell request to go to server B for images? (I've already copied the images to the htdocs folder on server B)

Also when users upload images (they get written to server A so how do they stay sync'd with Server B)?


Here's what I've done so far:
I've added a CNAME record to images.mydomain.com to the IP 123.123.123.2 (Server 2)

90% of my images are located (Server A):
mydomain.com/images
subfolder.mydomain.com/images1/
subfolder.mydomain.com/images2/

I guess I need to tell the server to send those request to (Server B):
images.mydomain.com
images.mydomain.com/images1/
images.mydomain.com/images2/

Correct?

If so, how do I go about that?
Thanks
Back to top


Reply to topic   Topic: Running one website via two apache web servers? View previous topic :: View next topic
Post new topic   Forum Index -> Apache