Recently, one of my clients asked me to mirror his web server. The only problem with this request was that I host his web site on my WHM reseller account, and his budget would only cover another shared hosting package. Mirroring one shared hosting server via another shared hosting server seemed possible; however, I knew that the budget constraints meant I would be piecing together my own solution...
Now a couple of months after his request, I am happy to report that I have successfully setup a mirror of my client's CPanel/WHM server. My technique combines the right combination of service providers, public key ssh authentication, rsync, mysqldump, and DNS Failover switching.
The Scenario
In this tutorial I am going to show you how to mirror a web server using two shared hosting accounts. Our mirror web server will automatically backup all scripts, files, and databases on the production web server. In addition, this tutorial will also describe how to setup DNS fail over switching that will monitor the status of the production server and automatically switch the DNS to point to the mirror server should the production server fail.
As this technique involves five distinct steps, I have divided this post into the following sections:
- Step 1: Selecting your service providers
- Step 2: Setting up public key ssh authentication
- Step 3: Using Rsync to mirror data between servers
- Step 4: Mirroring MySQL databases with mysqldump
- Step 5: Enabling DNS Failover Switching


Hi,
Please could you tell me if you have ever done mirroring for the plesk web servers.
Thanking you.
Regards,
Naseer.
This is for ressellers, how to backup entire dedicated server with cpanel and whm???
the sql sync isn“t good enough, imagine if i need to create all database of accounts??? is it possible to copy all information between the servers???
thanks - but at all is very good tutorial....
Michael, I find your article very informative and helpfull. Thank you very much for same.
Was wondering since you posted it on 2007, how has the setup performed since then? Are you still using it or have you moved to a more advanced setup.
Just want to get your production experience of it, before I implement it on a bunch of websites.
Thanks in advance.
If the server still asks for password then you need to check the following permission in your server.
* Change the permissions of .ssh to 700
* Change the permissions of .ssh/authorized_keys2 to 640
It took me 2 days to figure this out.