We are a small startup. In our current setup we have a dedicated server in a remote location. Our website and applications are hosted in that server. Website and some applications are in PHP and the rest are java applications using Tomcat and JBoss. Our database server is mysql. We backup mysql data to our local server using replication. Obviously thing can go wrong in multiple ways in this setup and they have. We had some serious downtime issues and other scares recently.
The new setup we have in mind is as follows.
1) Buying a new server with the same configuration as the current one. Setting this up similar to the current server with all the apps and software
2) Doing hot backup to the new server using BackupPC. (syncing only the often changing files like website, php apps, jboss and tomcat apps)
3) Running a mysql slave in the new server with semi-synchronous replication
4) Running apache/nginx/lighttpd as a reverse proxy in a separate server that points to the primary server.
5) Continue to run a slave in the local server
In case of downtime we can point the reverse proxy to the secondary server. We don't want to do automatic failover, because we have to make sure that the secondary server is fully synced before pointing to it.
What are the pros and cons of the above approach? Or how this can be improved? I understand the reverse proxy will be a SPOF. At this point we are looking for a cost effective solution. Can the reverse proxy be a low priced server with somewhat decent configuration?
I just put this together by reading various articles. It is possible that some of my understandings are wrong. Please feel free to correct them.
a cheap and easy solution that would eliminate your SPOF and need for a reverse proxy would be to set your DNS with low TTL value (e.g. 60 seconds), and simply change the IP address when you want to switch servers.
If you use a DNS provider with Dynamic DNS support (or Amazon Route 53), you can even write a small script that would even automate the process for you.