Web-site Multi-Homing
Multi-Homing is a method for distributing the load of your web-site across multiple servers using
a technique called a DNS Round Robin.
Cost Effective Load Distribution
For high traffic Web sites, a DNS Round Robin cycles through a list of IP addresses associated with the
domain name of your web site. Thus, each DNS lookup on your domain name sends the request to a different
IP in your DNS zone file. This distributes the requests for your Web site to the different servers hosting
your site, decreasing the number of requests that come to a single Virtual Private Server.
Redundant Backup and Access
By mirroring your Web site on two different machines, it decreases the already small chance that your site
content will be lost if one of your servers experiences a catastrophic failure. In addition, if one of
your Virtual Private Servers does go down, the mirrored server will decrease the effect of downtime
significantly.
NOTE: Multi-Homing is not a true load-balancing or mirroring solution, and we can not
guarantee any performance improvement by using it. In addition, Multi-Homing is not an effective solution
for web-sites with dynamic or frequently modified content, specifically including e-commerce sites and sites
using ASP, PHP, or CGI scripts. Furthermore, we do not support this configuration in any way. Any
questions about Multi-Homing configuration will be answered with a URL to this page.
Configuration
To configure your web-site for Multi-Homing, follow these steps.
Prepare Additional Servers
If necessary, order a new server to serve as the
second (or third, etc.) host for the site. You will want to set the server hostname to be different
from the primary host. You might consider using a scheme such as host1, host2, etc., or you
can give each host server a distinctly different name. It is very important that you are able to distinguish
between the separate hosts in the case of a problem.
On the second host, configure the apache server to
handle the domain name of the web-site. In addition to the primary domain name, you should configure a specific
cname to access this specific server. For example, you may want to configure the server to use the
domain host2.YOUR-DOMAIN.NAME. (If you are configuring the site as a
Virtual Subhost you will need to add the cname
domain to the opening VirtualHost tag. Otherwise, you only need to create the DNS record for the
cname.)
You will only want the primary server to handle e-mail for the domain. In order to make sure mail is handled
properly, make sure that the domain is not listed in the ~/etc/sendmail.cf or
~/etc/local-host-names files.
Create a CNAME for the secondary server
In order to access your primary and secondary servers specifically, you should create a DNS record pointing
specifically at each server. To do this, create an A record for each separate host similar to the
following in the zone file for the site's domain name.
host1 IN A 1.1.1.1
host2 IN A 2.2.2.2
Copy Content to the New Server
Once the secondary server is properly configured, SSH or
Telnet to the primary server, and cd to the DocumentRoot of the web site. In the
following example, we will assume this is ~/usr/local/etc/httpd/htdocs/. You will need to adapt the
commands to your specific configuration.
% cd ~/usr/local/etc/httpd/htdocs
The easiest way to transfer the files is to create a single, compressed, tar file which you can
copy over in one move. To do this, use the following commands (remember to adapt the commands to your
specific configuration).
% cd ..
% tar -cvf mysite.tar htdocs
This will create a file named mysite.tar in your ~/usr/local/etc/httpd/ directory. You now
need to copy the content to the second server. In this example, username is the
Virtual Private Server user account the second
server. (this command should all go on one line when you type it in).
% scp mysite.tar username@host2.YOUR-DOMAIN.NAME:/usr/local/etc/httpd/mysite.tar
You will be prompted to enter the password for username, and then the file will be transfered to
the new server.
Finally, connect via SSH or Telnet to the secondary server, and cd to the
~/usr/local/etc/httpd directory. If you type ls, you should find the mysite.tar file.
You will then need to extract the web site files from the tarfile. You can use the following command to do
this.
tar -xvf mysite.tar
The wget program is also an excellent
tool for mirroring your site.
Test the New Site
Go to the new site in your favorite web browser using the specific CNAME you configured earlier and
check to see that everything loads properly.
Go Live
Once you are certain that the secondary server is running properly, you can set up the DNS to do round
robbining. To do this, create an additional A record in your DNS Zone file for the main domain name,
and point it at your secondary server. You should now have two A records for your domain, something like
this:
@ IN A 1.1.1.1
@ IN A 2.2.2.2

|