This website and a couple of others are currently running on a Virtual Private Server, hosted by AWS. Unfortunately that means if it dies, all of my websites, emails and services go down. Because that’s not a very good way of doing things I’m creating a ‘Highly Available’ platform. AWS make this fairly easy, though it’s not without problems.
High availability means there should be duplicate failover servers, preferably loadbalanced. The problem with this is files. What happens when you modify a file on one server? There’s a couple of solutions that I looked into:
- GlusterFS. This is a very clever thing, and can synchronise files between several servers, giving a replica on each server. The problem is that it needs a bit of setting up, and this means it doesn’t autoscale very well.
- NFS. Linux native and pretty robust. The problem is that all files would be served from a central location. If that fails, there isn’t a local replica and failover isn’t easy.
- Rsync. This would rely on a central node, but all of the server nodes would be able to keep a local replica. Probably the easiest option.
After some testing, rsync came out on top. It’s not without its problems though. The biggest to overcome is file uploading and editing. It’s not ideal for applications where everyone is uploading files, that bit still needs some thinking.
With things like wordpress, is it possible to redirect people to the central server for /wp-admin ? After a fair bit of reading around, it turned out that AWS make this very easy. By having the website behind CloudFront, rules can be setup so that wp-admin/ and wp-login are pointed to the central server, and other things are directed to the load balancer. It also allows static content (pictures, css files etc) to be servers from edge locations for faster downloading, though that’s something to work out for another day.
Another thing that AWS provide is databases with automatic failover to another availability zone. All I have to do is check a box, and the rest is done for me.