开发者

How to keep row in multiple mysql databases in sync? Preferably with doctrine

开发者 https://www.devze.com 2023-02-16 03:43 出处:网络
What is, if there is, a good way to keep a row in to separate databases (possibly on different machines) in sync?

What is, if there is, a good way to keep a row in to separate databases (possibly on different machines) in sync?

For clarity. I have multiple mysql databases who share a user table with the same schema. There is a "master" database that has it's own unique schema, but contains the user table which contains all user records. Then there are multiple "slave" databases who for the most part share the same schema, that also contains the user table (with the same schema) with stores a subset of user records.

When an update is made to an instance of the user record in any database I want that change propagated开发者_高级运维 to too all instances of that user record in all databases it is in.

I'm using mysql, php5.3, and doctrine 1.2.x for an orm, running on ubuntu VPS servers.


Don't try to do this using PHP or Doctrine: look to MySQL replication to keep the slave database tables in synch with the master


It sounds like you're looking for MySQL replication and in specific, the replicate-do-table configuration option to restrict the slave databases to only caring about specific table(s) from the master.

0

精彩评论

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