We have 2 web servers running Apache and MySQL. The way it is working now is that server1 is where all people upload their html. All these files then automatically get mirrored over to server2, which is the \'live server\'.
The reason for this is so there will always be one accurate web server, if ever one of them goes down. Now, the problem here is having dynamic content being generated on server2 (like user data being inserted into MySQL on server2 by guestbooks and polls, etc) and also having content management on server1 (so authors can update pages without know html). This leads to different info in the 2 databases. Mirroring is a destructive process that will remove new entries, and it doesn\'t matter what direction this process is going, since data is being inserted on both servers at random times.
Any ideas? I am thinking that we could specify the mirror process to only copy 1 or 2 databases from server2 to server1. All the \'live\' content would have to go to these specific databases. Then, the author-generated content on server1 would be in 1 or 2 databases that are different. Then it is a matter of making sure the right databases get copied over in the righ direction.
Still, the problem is that the mirror process is run once per hour, so all content being generated those other 59 minutes would be lost if one server crashes, and the databases would be out of sync. How can we keep them identical?
Another way would be to use only one MySQL server, and use tcp/ip to connect from one machine, and the usual tmp socket way with the other. But doesn\'t it lead to poor performance and also security problems by connecting over tcp/ip? I am not quite sure how bad idea it is to connect remotely like that.
Any advice would be greatly appreciated. Sorry for the lengthy post.