Before going too far, it is clear from the discussion that one of the linux variants is strongly recommended for the OS. For the applications I'm assuming Apache and MySQL.
The high availability web server setup seems pretty straightforward - put a load balancer in front of 2+ web servers. There has been some discussion of the use of a reverse proxies, hardware and software load balancers ... but all in all this looks relatively easy. (References: Linux Virtual Server and a LVS how-to; Squid used at SFSU, and here, and disputed here(!); other options mentioned include Perlbal, Balance, Varnish and a request for varnish experience reports?)
The big issue, as far as I can tell is the database. And here is what I've gleaned (check out the MySQL docs on HA for a good overview of replication and clustering):
- MySQL Clustering won't work for moodle - MDL-9718
- Further, a report from the recent MySQL conference suggests that "as great as clustering is, it's not the recommendation in most cases. The takeaway I got is that unless your database is running thousands of queries per second than vertical scaling is likely a better solution." Which fits with my initial read of the Cluster Evaluation Guide. Although the two server setup looks enticingly easy!
- This leaves us with replication ... and a failover process.
MySQL replication: |
DRBD like in this setup: |
Reverse proxy and replication like this:![]() |
In either scenario, there needs to be some automated process to manage the failover. If the primary database goes down, then the application (moodle) needs to redirect queries to the slave.
Which leads me to my three remaining questions:
- How is automated failover best achieved?
- I am guessing that people are using something like heartbeat to detect a failure of the primary MySQL server and trigger a script that changes the moodle/config.php files on each of the web servers to look a the slave database. Is this correct?
- I am concerned that if the main table gets corrupted, then so too will the slave. Also, I like the idea of having a slave available for the creation of backups (due to the ability to stop the slave db server, create backup, restart and let the slave catch up) ... maybe the answer is to do both?
- Other than throwing more RAM and CPU at the primary server (and using memcached , db tuning). I can't see that moodle will support a master for writes and slaves for reads due to the nature of the application. with many slave - vertical scaling)?
Any help and comments appreciated.