I've recently setup a loadbalanced solution for our websites. We host about 200 sites, most run of our custom application, but some are running wordpress blogs (in which files can be uploaded/deleted). The setup is basic:
|-------------------> Apache1 | HAProxy -| | |-------------------> Apache2
I've set up
Apache1 as a 'master', so that most of the changes made on it are rsync'd over to
Apache2 every minute using the following command:
rsync -av --delete apache1:/var/www/html/ /var/www/html/
The problem is, as mentioned earlier, in some cases files are added/removed on
Apache2. The only solution I've come up with so far is to have
Apache1 rsync all files in certain directories (wp-content, for instance) to itself (not delete), then push everything back to
This has it's flaws, the main ones being:
- The two servers will eventually get extra files that have been deleted on
- As I add more servers, the rsync script will take longer to complete.
Are there any ways to keep 2+ web servers synched, taking into account that both servers can have files added, updated and deleted?