This page shows all the machines you have in your cluster that are being controlled by this admin server. By default you will only have a one machine cluster. You can add more by clicking on the "Configuration" link. Machines that are not working, or not accessible by the admin server will show up as red. Clustering
Introduction to Clustering
It is often desirable to host websites over a cluster of machines, rather than just one machine. The main advantages are:
- Cheaper Hardware - two small machines combined can be more powerful than a single far more expensive machine.
- Easy 'horizontal' scalability - if your servers become heavily loaded you can easily and cheaply add new machines to your cluster. With a single machine you would have to replace your machine with a bigger machine.
- Fault-tolerance - by using an intelligent load-balancer you can create a fault-tolerant system where your web sites continue to be served even if one of your machines fail.
Load Balancing Options
- Round-Robin DNS
- The simplest way of hosting a site across multiple machines is to set up the DNS records, so that the site name has multiple IP addresses, and then have each machine in the cluster resolve to one IP address. For example, if you have two machines with addresses 10.0.0.1 and 10.0.0.2, you could make www.mysite.com have a DNS record that resolves to both addresses. Round-robin DNS is naive in the way it distributes load as it does not take into account the load on the web servers, or how fast the machines are. Nor does round-robin DNS does not provide any fault-tolerance.
- Smart load-balancing routers
- Several companies (such as Alteon, Arrowpoint and Cisco) provide switches or routers that can distribute the load across multiple back end machines. With some of these products all the web servers bind to the same IP addresses. These devices can provide fault-tolerance, and can typically balance the load based on either response-times or by the amount of network traffic.
- The Zeus Load Balancer
- The Zeus Load Balancer is a software solution that runs on generic UNIX hardware. It acts like a smart HTTP proxy balancing the load between the back-end machines. The Zeus Load Balancer monitors the response times of all the web servers, and forwards the requests to the machines that are responding the quickest. Should one of the web servers fail, incoming requests will be transparently routed to other machines. The real strength of the Zeus Load Balancer is that it integrates into the Zeus Admin Server, and fully supports both IP based and Host header based virtual hosting and allows both session support whereby a client invoking a multi-page database transaction can be sent to the same back-end machine during the session/transaction, and segmentation of the backend hardware so only certain URLs can be hosted by subsets of the backend machines (e.g. those with an Oracle database or ASP functionality).
How Zeus Web Server Handles Clustering
When you start a web site, the admin server sends the configuration to each of the web servers you have configured. Each web server then writes out a local copy of that configuration file in $ZEUSHOME/web/runningsites. This means the web server machine can reboot/restart without needing to communicate with the admin server.Rewriting Configuration
It is often necessary to have slightly different configuration on each web server. To make this process as easy as possible, Zeus Web Server provides a built-in mechanism for rewriting configuration settings on the fly.When the web server receives a web site configuration from the admin server it writes it out to disk, but before it starts the server, it will look for a script called $ZEUSHOME/web/bin/rewrite. If this script exists, it will be run. This script takes two arguments: the first argument is the name of the virtual server, the second argument is the name of the configuration file. The rewrite program should not be group/world writeable.
This script can then rewrite the file, altering settings such as the IP bind address, document or log file locations that might vary between servers.
E.g.
#!/bin/sh # $1 = vserver, $2 = file # # Rewrites the website name to http://`hostname`:4000/ mv $2 /tmp/z$$ sed "s/^ip_name .*/ip_name `hostname`/;s/^port .*/port 4000/" \ < /tmp/z$$ > $2 rm /tmp/z$$