I know how to run two or more tomcats under one apache server. I want to know how to run two or more apache servers in a cluster and run my application. I know it's possible. can someone suggest a simple tutorial? there are many articles for apache - tomcat integration, but not for apache clustering. :( it would be great if you guys suggested a basic tutorial. thanks.
Looking at a pair of hardware appliances will certainly be a good start. You can do it in software, but you may find that your networking team (if you have one) may object to you performing network-related functions on non-approved equipment -- this can limit failover technologies.
Apache (httpd) itself doesn't know anything about clustering httpd instances. You should therefore have a way (ie. a script) to synchronise the config from one node to the other worker nodes. I'll assume that your httpd instances are working as a reverse-proxy, although that doesn't have to be the case).
You will certainly want to invest some time and energy in centralising the logging, and for this I have found the ELK stack to be tremendously useful. Here's a fairly extended CustomLog declaration -- everything in there has proved to be useful at some point.
To log cache hit/miss in Apache 2.2 (this is better in 2.4, but we don't use it):
And then include
Don't forget a logrotate rule:
You would then need to choose a log-shipper (there are many to chose from), which will tail the log-file and send them off to the ELK stack.
Note that sometimes comparing configurations is very useful to do... or rather auditing for differences, or just finding out where something is set. For that, I have a tool I wrote called httpd-dump-config, which I use very frequently when configuring the over 1000 lines in our reverse-proxy config.
get a software or hardware load balancer and put it in front of the apache servers.
1) install free load balancer: "balance" from http://www.inlab.de/balance-3.42.tar.gz
2) run: balance -f 80 server1:80 server2:80 server3:80
advanced tutorial: The problem with the solution above is that it introduces a single point of failure. If your "balance" server dies, then you cannot access anything behind it.
If you want to go with a home grown solution GPL, then you need to run "vvrpd", "heartbeat" or some other failover cluster solution (or google: linux load balancing).
If you want to stay with a software solution, but have money, you could look at Redat Cluster, Veritas Cluster, or some other vendors cluster software.
Your best/most reliable solution though is to get a pair of hardware load balancers (which will do failover automatically).
I'm assuming that you want to run this on multiple machines (running multiple Apache instances on the one machine makes very little sense).
Unfortunately, you can't find a simple tutorial for HA clustering because it's not a simple topic. You've got a lot of different concepts, ranging from low-level network stuff to application-specific items like shared data storage.
I started my clustering adventures at http://linuxvirtualserver.org/. You might like to start at http://www.linuxvirtualserver.org/architecture.html and go from there.