开发者

Synchronizing MySql DBs data

first of all I am new to the distributed DB world, anynhow scenario is:

I have three servers in US, Sweden and Australia, same web application has been deployed on all of them with mysql DB (same structure). as different users are using these application and all three DBs have different data; now from now we need to synchronize the DB data every time if any change 开发者_StackOverflowhappened into the data in any one of the server automatically; tell me what can be the optimized solution.

or if we use one same DB server for all web servers, will it slow down the speed of application ?

please suggest something to start with.


This is pretty much exactly what replication is for.

http://dev.mysql.com/doc/refman/5.0/en/replication-howto.html

EDIT: Unless you are using a web accelerator company (Akamai, etc) I don't suggest using a single server due to slow response times.


There are several issues you will face if you use standard MySQL replication:

  1. MySQL replication is basically master -> slave. So updates are done on the master that then replicates tehm to the slave. This can be very effective, but it generally means that two of your locations will have slow updates, but reads will be normal speed.

  2. A corrolary of 1 - Transactions take place on the Master so if you create anew record and get the LAST_INSERT_ID() and insert it into another table, all reads and writes need to go to the MySQL master as teh changes will not be visible on the slave until the transaction completes.

  3. Can your existing data be integrated into one dataset? If not then you may have problems.

  4. Is the application "office aware". In other words, if you put data from several offices together will it still work? Does the application make assumptions about the data based on the office it is in?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜