Mirrored dynamic sites using WordPress

July 23rd, 2006

When synchronizing content across two or more servers one of the trickier aspects is handling user updates – forum posts, comments etc. If updates are accepted on all servers then merging the data would be a regular headache.

Instead, ClonePanel requires that each server be given a role – slave or master – and updates made on the master are copied to the slave. If any changes were made on the slave they would be overwritten and lost at the next sync. So it’s essential that the master server should handle all user updates and the slave must always be read-only.

WordPress handles this perfectly through the two setup options: WordPress address and Blog address.

The blog address is used throughout the site for links to posts, categories and pages – this can be blank to ensure that a visitor browsing the site (master or slave) will stay on the same site / server he first arrived at.

The WordPress address is used in links to admin functions (Register, Login, Dashboard) and in the action of forms – all the things that change the site in any way. So here we use the fully-qualified uri of the master server and ensure that all changes are made only there.

This site itself is an example. It’s available at clonepanel.com and clonepanel.net – one hosted in Australia the other in California (you may notice a slight speed difference, depending on your own location). You can browse either site without problems but as soon as you try to register, log-on or leave a comment you will find yourself on clonepanel.com – the master server.

The next step is to introduce failover – if the master server goes offline, how can the slave take over? That’s more difficult, and will be the subject of many future posts…

High-availability web hosting at an affordable price

July 21st, 2006

ClonePanel is a software toolkit for backup and synchronization, monitoring and dns control with the ultimate aim of making it possible to operate a web site on two or more separate hosting accounts, giving you:

Fully redundant DNS service
Use the nameservers of both hosting services to provide DNS information about your domain.
Fully redundant mail service
Use one account as your primary mail server, the other as your secondary. Any mail collected on the secondary is transferred at regular intervals to the primary.

Your own multiple snapshot-type backups
Regularly downloading full backups from a hosting control panel is tedious and wasteful. Using the standard linux system tools (notably rsync, ssh, gzip and hard links) you can:

  • Download over a secure connection with data compression
  • Transfer only what’s changed (only the modified part of changed files)
  • Keep multiple copies of your complete web site using disk space that’s only the total size of the site plus changed files.
Hot-spare server
A spare hosting account complete with your web sites, kept up to date and ready to go whenever it’s needed.
DNS Fail-over or round-robin load sharing
Fail-over means that your primary server will handle all requests under normal circumstances, but if it fails DNS is switched automatically to the backup. Round-robin uses multiple A records to the main web site so that visitors are shared between the servers at all times. You will need to decide which is suitable for your site, and what changes are needed to implement them.