DNS load sharing
Pros:
* Protocol independent: supports web, ftp, etc.
Cons:
* Session not sticky
* Fail over only. No load sharing
Redirected Secondary Name Server
* Set primary web server as primary name server and TTL to long (e.g. 30 min) so it can be cached.
* Set secondary web server as secondary name server.
* Works only when whole machine goes down so both DNS and Web servers go down.
Load Sharing with Round Robin DNS
* Need BIND 4.9 and above.
* Setup round robin configuration:
www.my.com. 300 IN A 192.168.100.1 www.my.com. 300 IN A 192.168.100.2 www.my.com. 300 IN A 192.168.100.3
* Set TTL short so it won’t be cached (e.g. 5 min or 300 sec).
Software Based Clustering
Floating IP Failover
* Each server has its own IP. A floating or virtual IP is assigned to primary server normally and backup web during failover.
* No need for DNS servers.
Linux Virtual Server
Ultra Monkey
* Servers involved must all be in the same local network with no intermediate routers involved.
Super Sparrow
* Allows distributed clustering.
Apache Load Balancing
* Set up one Apache as dedicated proxy server
# Apache Server Configuration for Clustering Proxy # ### Basic Server Setup # The proxy takes the identity of the web site... ServerName www.alpha-complex.com # Basic configuration. # Note that the DocumentRoot is a 'safe' irrelevant value as we don't serve # anything directly ServerAdmin webmaster@alpha-complex.com ServerRoot /usr/local/apache DocumentRoot /usr/local/apache/proxysite ErrorLog /usr/local/apache/proxy_error TransferLog /usr/local/apache/proxy_log # Choose a non-privileged user and group User httpd Group httpd # Dynamic servers load their modules here... # Note that if this proxy is only a proxy, we don't need most standard # modules loaded. # Don't waste time on things we don't need HostnameLookups off # This server is only for proxying so switch off everything elseOptions None AllowOverride None # Allow a local client to access the server status order allow,deny deny from all allow from 127.0.0.1 SetHandler server-status ### Part 1 - Rewrite # switch on URL rewriting RewriteEngine on # Define a log for debugging but set the log level to zero to disable it for # performance RewriteLog logs/proxy_rewrite RewriteLogLevel 0 # define the cluster servers map RewriteMap cluster rnd:/usr/local/apache/rewritemaps/cluster.txt # rewrite the URL if it matches the web server host RewriteRule ^http://www\.(.*)$ http://{cluster:www}.$2 [P,L] # forbid any URL that doesn't match RewriteRule .* - [F] ### Part 2 - Proxy ProxyPassReverse / http://wwwl.alpha-complex.com/ ProxyPassReverse / http://www2.alpha-complex.com/ ProxyPassReverse / http://www3.alpha-complex.com/ ProxyPassReverse / http://www4.alpha-complex.com/ ProxyPassReverse / http://www5.alpha-complex.com/ ProxyPassReverse / http://www6.alpha-complex.com/ # We don't want caching, preferring to let the back end servers take the # load, but if we did: # # Apache 2.0 only: CacheOn on CacheEnable disk / # Apache 2.0 and 1.3: #CacheRoot /usr/local/apache/proxy #CacheSize 102400
Hardware Based Load Clustering
F5 Big-IP
Cisco MNLB
ServerIron
Nortel Alteon
References
Professional Apache 2.0 by Peter Wainwright
The Linux Enterprise Cluster by Karl Kopper