简体   繁体   中英

How to sync two databases in different locations without using Replication?

I have taken on a project that was written by another developer. The client has asked for a disaster recovery solution, where databases are synced between the two hosting providers. I thought, great, I can just set up Replication, however, half way through the project I realized that the Master site is on a shared host, I therefore, don't have access to my.cnf or any off the core files to that matter.

Ok, so that solution is currently out of the question, so I thought I would duplicate the SQL queries in the PHP (I know that this really is not good practice, but it's a necessity), the code is very poorly written, there are some custom functions, around 200 files and not all of these use these functions for the database calls etc. So duplicating the queries would be a very, very time consuming task.

Does anyone know of another way in which to keep two databases on different servers in sync at all times?

I'd second the recommendation to move to a VPS. But I recommend Digital Ocean or Linode over Amazon AWS. They are much more affordable and easier to setup. In fact, if the current site is on an "economy" shared host, your client will probably like Digital Ocean's pricing (no, I do not work for them.).

Once the site is on a VPS in, say, New York, you will have the freedom to set up a replicated system in another zone (San Francisco, London, etc.). That will give the client piece of mind worth the hassle of the initial move.

You could pull this off starting at $10/month for two Digital Ocean VPSs--assuming that the client's needs fit within the $5 server's resources.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM